In [4]:
import numpy as np
import pandas as pd
import seaborn as sns
%matplotlib inline
Loading CSV file into dataframe
In [8]:
df1 = pd.read_csv('df1', index_col=0)
Loading dataframe´s head items (5 top items)
In [9]:
df1.head()
Out[9]:
Loading df2 file
In [10]:
df2 = pd.read_csv('df2')
Displaying dataframe´s head
In [11]:
df2.head()
Out[11]:
Calling dataframe´s bult-in visualization methods to create a histogram
In [12]:
df1['A'].hist(bins=20)
Out[12]:
In [15]:
#df1['A'].plot(kind='hist', bins=30)
df1['A'].plot.hist()
Out[15]:
Creating a stacked bar visualization from dataframe´s columns
In [20]:
#df2.plot.area()
df2.plot.bar(stacked=True)
Out[20]:
Line plot from df1 data, showing 'B' column
In [24]:
df1.plot.line(x=df1.index, y='B', figsize=(12, 3), lw=1)
Out[24]:
Creating a scatter plot for A & B
In [28]:
#df1.plot.scatter(x='A', y='B', c='C', cmap='coolwarm')
df1.plot.scatter(x='A', y='B', s=df1['C'] * 100)
Out[28]:
Other pandas visualization built-in funcitions, such as boxplots, hexbin plot and kde (Kernel Density Estimator) plot
In [29]:
df2.plot.box()
Out[29]:
In [30]:
df = pd.DataFrame(np.random.randn(1000,2), columns=['a','b'])
df.head()
Out[30]:
In [32]:
df.plot.hexbin(x='a', y='b', gridsize=25)
Out[32]:
In [35]:
#df2['a'].plot.kde()
#df2['a'].plot.density()
df2.plot.kde()
Out[35]:
In [ ]: