import pandas as pd
df = pd.read_csv('itunes_data.csv')
df['Minutes'] = df['Milliseconds'] / (1000 * 60)
df['MB'] = df['Bytes'] / 1000000
df.drop(['Milliseconds', 'Bytes'], axis=1, inplace=True)
import matplotlib.pyplot as plt
df['Minutes'].plot.box()
plt.show()
df['Minutes'].plot.box()
import seaborn as sns
_ = sns.boxenplot(y=df['Minutes'])
# plot multiple columns at once
sns.boxenplot(data=df[['Minutes', 'MB']])
# save figure for book
f = plt.figure(figsize=(5.5, 5.5)) # this changes the size of the image -- more on this is chapter 5
f.patch.set_facecolor('w') # sets background color behind axis labels
sns.boxenplot(y=df['Minutes'])
plt.tight_layout() # auto-adjust margins
plt.savefig('B17030_05_02.png', dpi=300)
sns.boxenplot(y=df['Minutes'])
plt.yscale('log')
#@title Default title text
# save figure for book
f = plt.figure(figsize=(5.5, 5.5)) # this changes the size of the image -- more on this is chapter 5
f.patch.set_facecolor('w') # sets background color behind axis labels
sns.boxenplot(y=df['Minutes'])
plt.yscale('log')
plt.tight_layout() # auto-adjust margins
plt.savefig('B17030_05_03.png', dpi=300)
df['Minutes'].plot.box()
plt.yscale('log')
df['Minutes'].plot.box()
plt.yscale('log')
# another way to use a log scale
df['Minutes'].plot.box(logy=True)
df['Minutes'].describe()
No comments:
Post a Comment