Professional Documents
Culture Documents
Numpy NP Pandas PD Matplotlib - Pyplot PLT: Import As Import As Import As Matplotlib
Numpy NP Pandas PD Matplotlib - Pyplot PLT: Import As Import As Import As Matplotlib
Numpy NP Pandas PD Matplotlib - Pyplot PLT: Import As Import As Import As Matplotlib
In [107]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
In [69]:
In [3]:
income[100:110]
Out[3]:
[41555, 82746, 67628, 67742, 53496, 51186, 9397, 85779, 1941, 75908]
In [108]:
plt.hist(x=income)
Out[108]:
(array([ 93., 74., 100., 90., 116., 90., 114., 111., 107., 105.]),
array([1.0000e+00, 9.9930e+02, 1.9976e+03, 2.9959e+03, 3.9942e+03,
4.9925e+03, 5.9908e+03, 6.9891e+03, 7.9874e+03, 8.9857e+03,
9.9840e+03]),
<a list of 10 Patch objects>)
In [109]:
plt.figure(figsize=(12,6))
plt.hist(x = income)
Out[109]:
(array([ 93., 74., 100., 90., 116., 90., 114., 111., 107., 105.]),
array([1.0000e+00, 9.9930e+02, 1.9976e+03, 2.9959e+03, 3.9942e+03,
4.9925e+03, 5.9908e+03, 6.9891e+03, 7.9874e+03, 8.9857e+03,
9.9840e+03]),
<a list of 10 Patch objects>)
In [110]:
plt.figure(figsize=(12,6))
plt.hist(x = income, label = 'Frequency Distribution')
plt.legend()
plt.xlabel('Worth')
plt.ylabel('Frequency')
Out[110]:
plt.figure(figsize=(12,6))
plt.hist(x = income, label = 'Frequency Distribution', edgecolor='white')
plt.legend()
plt.xlabel('Worth')
plt.ylabel('Frequency')
Out[111]:
In [112]:
plt.figure(figsize=(12,6))
plt.hist(x = income, label = 'Frequency Distribution', edgecolor='white', color='#CCAAC
C')
plt.legend()
plt.xlabel('Worth')
plt.ylabel('Frequency')
Out[112]:
plt.figure(figsize=(12,6))
plt.hist(x = income, label = 'Frequency Distribution', edgecolor='white', color='#CCAAC
C', bins=20)
plt.legend()
plt.xlabel('Worth')
plt.ylabel('Frequency')
Out[113]:
In [114]:
[i for i in range(10)]
Out[114]:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
In [115]:
plt.figure(figsize=(12,6))
plt.hist(x = income, label = 'Frequency Distribution', edgecolor='white', color='#CCAAC
C', bins=[i for i in range(0,10001, 500)])
plt.legend()
plt.xlabel('Worth')
plt.ylabel('Frequency')
Out[115]:
plt.figure(figsize=(12,6))
plt.hist(x = income, label = 'Frequency Distribution', edgecolor='white', color='#CCAAC
C', bins=[i for i in range(0,10001, 500)])
plt.legend()
plt.xticks([i for i in range(0,10001,500)])
plt.xlabel('Worth')
plt.ylabel('Frequency')
Out[117]:
plt.figure(figsize=(12,6))
plt.hist(x = income, label = 'Probability Density', edgecolor='white', color='#CCAACC',
bins=[i for i in range(0,10001, 500)], density=True)
plt.legend()
plt.xticks([i for i in range(0,10001,500)])
plt.xlabel('Worth')
plt.ylabel('Probability')
Out[118]:
plt.figure(figsize=(12,6))
plt.hist(x = income, label = 'Cumulative Density', edgecolor='white', color='#CCAACC',
bins=[i for i in range(0,10001, 500)], density=True, cumulative=True)
plt.legend()
plt.xticks([i for i in range(0,10001,500)])
plt.xlabel('Worth')
plt.ylabel('Cumulative Probability')
Out[119]:
plt.figure(figsize=(12,6))
plt.hist(x = income,
label = 'Cumulative Density',
edgecolor = 'black',
color='#AACCAA',
bins=[i for i in range(0,10001, 500)],
density=True,
cumulative=True,
histtype='step')
plt.legend(loc=2)
plt.xticks([i for i in range(0,10001,500)])
plt.xlabel('Worth')
plt.ylabel('Cumulative Probability')
Out[121]:
In [122]:
nparr = np.random.normal(0,1,1000)
In [123]:
plt.figure(figsize=(9,5))
plt.hist(x = nparr, label = 'Normal Distribution', edgecolor='white', color='#CCAACC',
bins = 15, density=True)
plt.legend()
Out[124]:
<matplotlib.legend.Legend at 0x25795f5d0b8>
In [ ]:
In [125]:
In [126]:
tips = sns.load_dataset('tips')
In [127]:
type(tips)
Out[127]:
pandas.core.frame.DataFrame
In [128]:
tips.head()
Out[128]:
In [129]:
Out[129]:
In [ ]: