Skip to content

Instantly share code, notes, and snippets.

View uomodellamansarda's full-sized avatar
🤩

Andrea uomodellamansarda

🤩
View GitHub Profile
#!/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',
@uomodellamansarda
uomodellamansarda / disneyrevenuesstreamsanalysis.ipynb
Created November 21, 2020 17:11
DisneyRevenuesStreamsAnalysis.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#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 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)
#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)
#Importiamo i moduli necessari
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
@uomodellamansarda
uomodellamansarda / disneymoviesanddirectorsanalysis.ipynb
Last active November 16, 2020 13:35
DisneyMoviesAndDirectorsAnalysis.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#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
dataframe.info()
#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()