This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import pandas as pd | |
url = 'https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-andamento-nazionale/dpc-covid19-ita-andamento-nazionale.csv' | |
usecols=[ | |
'data', | |
'tamponi', |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#plot section | |
fig,ax=plt.subplots(figsize=(8,4), | |
facecolor='white', dpi=300) | |
#b1 b2 b3 b4 contains the total revenues | |
#divided by revenue range | |
#b1<20 $ billion | |
#20<b2<40 $ billion | |
#40<b3<60 $ billion | |
#60<b4 $ billion | |
ax.bar(b1x,b1,color="lavender") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this function will plot the barpolot for the different balance lines | |
#the default color for the main bar is midnight blue | |
#but you can change in pink, darkpink or magenta it is Disney! | |
def bar_plot(x1,y1,y2,y_2_label='Compared Variable',title="You Forgot The Title",bar_col='midnightblue'): | |
fig, ax = plt.subplots(figsize=(10,5), | |
facecolor='white', dpi=300) | |
twenty=np.full(len(x1),20) | |
forty=np.full(len(x1),40) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Carichiamo e leggiamo il csv | |
csvname="reading_pomodoro_records.csv" | |
#definiamo le colonne | |
columns_name=['Index','Year', 'Month', 'Day', 'Time', 'Length', 'Start', 'End', 'Activity', 'Date','main_activity','sub_activity'] | |
#Saltiamo la prima riga contentente i titoli delle colonne del dataframe | |
#Attraverso l'argomento skiprows | |
df=pd.read_csv(csvname,names=columns_name,sep=',',skiprows=1, index_col=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Importiamo i moduli necessari | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import numpy as np |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#diff is a set containing the missing movies | |
#from the movies' revenues DataFrame | |
#bambi, robin hood, dumbo ecc... | |
#the set is converted into a list | |
missing_list=list(diff) | |
print(missing_list) | |
#a pattern is created | |
#in order to define filter | |
pattern = '|'.join(missing_list) | |
#creating the boolean mask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataframe.info() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#top 10 most successful directors based on a single movie | |
top10_dir_absolute=df_inner_join.groupby('director').mean().sort_values(by=['inflation_adjusted_gross'],ascending=False).head(10).reset_index() |
NewerOlder