df.describe()
df['col'].max()
df['cdl'].idxmax()
df.corr() # describes the corrilation between cols
df['col'].value_counts() # counts num of each value
df['col'].unique() # what are the unique values
df['col'].nunique() # how many are there
df['col'].replace(['old', 'old1'], ['new', 'new1'])
# does the same as replace
mymap = {'old':'new', 'old1':'new1'}
df['col'].map(mymap)
df.duplicated() # returns a boolean_list with true on first dup
df.drop_duplicates()
df['col'].between(lowIndex,upperIndex,inclusive=True)
# returns boolean_list
df.nlargest(2,'colName') # returns the 2 largest values
df.nsmallest(2,'colName')
df.sample(5) # 5 random rows
df.sample(frac=0.1) # random 10% of rows
df.str.METHOD() # does method on everything
df.str.isdigit() # boolean series
df.str.split(',') # creates an array with elements split on ','
# expand=True this turns the array into cols
#cleaning
df.str.replace(';', '')
df.str.strip() # removes white space
Time Methods
from datetime import datetime
date = datetime(year, month, day, hours, mins, secs) # all vars are ints
# note in df probs date stored as a string
# this converts most string formats
df['date'] = pd.to_datetime(df['date'])
# dayfirst=True, so you can specify if the day is first in the date,
# although it does a good job of guessing, but use the above to be safe
# format='%d--%b--%Y'