Cheat Sheet: Python For Data Science
Cheat Sheet: Python For Data Science
Arithmetic Operations:
•
ations -
G r - oReturns
df.groupby(column) u paBgroupby
y object for values
SCIENCE •
•
pd.read_csv(filename)
pd.read_table(filename)
View DataFrame Contents:
• df.head(n) - look at first n rows of the DataFrame. •
from one column
df.groupby([column1,column2]) - Returns a groupby
CHEAT SHEET •
•
pd.read_excel(filename)
pd.read_sql(query, connection_object)
•
•
df.tail(n) – look at last n rows of the DataFrame.
df.shape() - Gives the number of rows and columns. •
object values from multiple columns
df.groupby(column1)[column2].mean() - Returns the
• df.info() - Information of Index, Datatype and Memory. mean of the values in column2, grouped by the values in
• pd.read_json(json_string)
Python Pandas • df.describe() -Summary statistics for numerical column1
columns. • df.groupby(column1)[column2].median() - Returns the
Selection: mean of the values in column2, grouped by the values in