top of page

Python Fundamentals (Part 4.)

  • Writer: CL
    CL
  • Mar 7, 2020
  • 1 min read

Updated: Apr 8, 2020

02/19 - 02/24


Missing Values

isnull(); isna(); notnull()


ree

ree

ree

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

ree

ree

df.fillna()


ree

ree

duplicated()

Notes: duplicated(keep='first')

default setting is keep = 'first'

duplicated(keep='last')

duplicated(keep=False)



ree

ree

df.drop_duplicates


ree

pd.Series


ree

ree

df.groupby()


ree

ree

ree

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


ree

ree

pd.MultiIndex.from_arrays()

df.groupby(level, ...)


ree

ree


# set_index()

# resample()

# pd.Grouper()


ree

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

ree

ree

df.agg()

ree

pd.merge()


ree

ree

Notes:

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

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

ree

pd.concat()


ree

ree

ree

ree

df.plot(); plt.show()


ree

Notes:

plt.subplot(num_rows, num_cols, plot_num)


ree

ree

ree

Comments


bottom of page