Python的数据处理
posted on 22 Aug 2017 under category 人生经验
df_all = pd.concat([df1, df2])
df_some_columns = df[["col1", "col2"]]
df_merged = pd.merge(df1, df2, on="id", how="left")
df_copy = df.copy()
df["id"].unique() # get unique id.
df["id"].nunique() # get number of unique id.
df.isnull() # get a data frame which elements are true/false.
df.isnull().sum() # get a series which indexes are column names, values are number of null elements in this column.
df.isnull().sum().sum() # get a integer which is the number of null elements in data frame.