A rudimentary note of Pnadas. Pandas has various functions, so make a note at any time.
Series
An advanced version of the regular list. List with index.
#coding:utf-8
import pandas as pd
#Definition
s = pd.Series([1,2,3],index=['a','b','c'])
#Access to elements
print s.a
#Various operations
print s.index;
print s.mean()
print s.sum()
print s.cumsum()
print s.tolist()
print s.to_dict()
DataFrame
Something like Excel in memory. Various processing can be performed in rows and columns.
#coding:utf-8
import pandas as pd
#Definition
df = pd.DataFrame([[1,2,3],[4,5,6],[7,8,9]],index=['r1','r2','r3'],columns=['c1','c2','c3'])
#Content display for the time being
print df
#Access to elements
print df.ix['r1','c1']
#Various operations (total of columns)
print df.ix[:,'c1'].sum()
I will add it as needed.
plot
Recommended Posts