Skip to content

Instantly share code, notes, and snippets.

@nithyadurai87
Created June 11, 2021 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nithyadurai87/802ecdbf63e468a8cb35bed60c219ae3 to your computer and use it in GitHub Desktop.
Save nithyadurai87/802ecdbf63e468a8cb35bed60c219ae3 to your computer and use it in GitHub Desktop.
import pandas as pd
s = pd.Series([90,83,67,83,45])
df = pd.DataFrame([[90,83,67,83,45],[68,89,75,56,73],[58,88,60,90,100]])
p = pd.Panel({'Midterm': pd.DataFrame([[90,83,67,83,45],[68,89,75,56,73],[58,88,60,90,100]]),
'Quarterly': pd.DataFrame([[35,44,65,56,79],[85,55,84,50,99],[65,90,87,69,78]])})
print (s.axes)
print (df.axes)
print (p.axes)
df2 = pd.DataFrame()
print (s.empty)
print (df2.empty)
print (p.empty)
print (s.shape)
print (df.shape)
print (p.shape)
print (s.ndim)
print (df.ndim)
print (p.ndim)
print (s.size)
print (df.size)
print (p.size)
print (s)
print (s.values)
print (df.values)
print (p.values)
print (s.head(2))
print (df.head(2))
print (s.tail(2))
print (df.tail(2))
# panel doesn't have these attributes
print (df.T)
# Panel & Series doesn't have these attributes
print (s.dtypes)
print (df.dtypes)
print (p.dtypes)
print (df)
print (df.describe())
print (df.sum())
print (df.sum(1))
print (df.mean(1))
print (df.std(1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment