Pandas - dylanmoz/notes GitHub Wiki

Pandas

DataFrames

pd.DataFrame(data, index: string[], columns: string[]): DataFrame - Create a dataframe
  • df['ColumnA']: Series - Selects ColumnA from DataFrame df

  • df['ColumnA', 'ColumnB'](/dylanmoz/notes/wiki/'ColumnA',-'ColumnB'): DataFrame - Selects ColumnA and ColumnB from DataFrame df

  • DataFrame.loc[index: number | string]: Series - Returns the row at index

  • DataFrame.loc[index: number | string, column: string]: any - Returns the value at index and column column

  • DataFrame.iloc[i: number]: Series - Returns the row at position i

  • df[(df['W'] > 0) & (df['X'] > 1)] - Return new data frame where column W is greater than 0 and X is greater than 1