import pandas as pd
df = pd.read_csv('downloads/adeshbhai.csv')
df.head()
Out[1]:
In [2]:
df.tail()
Out[2]:
In [7]:
import matplotlib.pyplot as plt # import library
x = df['Region'] # store the value in x
y= df['Country'] # store the vatue in y
plt.plot(x,y) # Simple plot in two data
plt.show() # for shown in figure command shell or jupyter notebook
In [8]:
plt.scatter(x,y) # plot the Scatter plot
Out[8]:
In [11]:
plt.bar(x,y) # plot the bar plot
Out[11]:
In [13]:
df.index[1] #The index (row labels) of the DataFrame.
Out[13]:
In [15]:
df.columns[ : 3] # The column labels of the DataFrame.
Out[15]:
In [20]:
df.columns[0: ] # The column labels of the DataFrame.
Out[20]:
In [24]:
df.dtypes #Return the dtypes in the DataFrame.
Out[24]:
In [26]:
df.ftypes # Return the ftypes (indication of sparse/dense and dtype) in DataFrame.
Out[26]:
In [29]:
df.get_dtype_counts() # Return counts of unique dtypes in this object.
Out[29]:
In [30]:
df.get_ftype_counts() #Return counts of unique ftypes in this object.
Out[30]:
In [33]:
# applying get_value() function
df.get_value(1, 'Order ID') #get_value( index,col)
Out[33]:
In [34]:
# column index value of "Name" column is 0
# We have set takeable = True
# to interpret the index / col as indexer
df.get_value(4, 0, takeable = True)
Out[34]:
In [40]:
df.groupby('Country').mean()
Out[40]:
In [41]:
df.groupby('Region').mean()
Out[41]:
Comments