top of page
Writer's pictureCindy Lin

Python Fundamentals (Part 4.)

Updated: Apr 8, 2020

02/19 - 02/24


Missing Values

isnull(); isna(); notnull()




df.dropna()

default axis =0

default how = "any" , which means that if any row contain any NaN, that row will be dropped!

if how="all", rows that include NaN in every column will be dropped


df.fillna()



duplicated()

Notes: duplicated(keep='first')

default setting is keep = 'first'

duplicated(keep='last')

duplicated(keep=False)





df.drop_duplicates



pd.Series



df.groupby()




/////// df.groupby() & dictionary



pd.MultiIndex.from_arrays()

df.groupby(level, ...)





# set_index()

# resample()

# pd.Grouper()


Note: 'MS' means 'beginning of the month'


df.agg()

pd.merge()



Notes:

in df1, subject_id: sub1,sub2,sub4,sub6,sub5

in df2, subject_id: sub2, sub4, sub3,sub6,sub5


pd.concat()





df.plot(); plt.show()



Notes:

plt.subplot(num_rows, num_cols, plot_num)





56 views0 comments

Recent Posts

See All

Comments


bottom of page