delete column pandas by index code example
Example 1: get column number in dataframe pandas
# PANDAS: get column number from colomn name
dataframe.columns.get_loc("<col_name>")
Example 2: dataframe delete row
df.drop(df.index[2])
Example 3: drop a column in pandas
df = df.drop(df.columns[[0, 1, 3]], axis=1) # df.columns is zero-based pd.Index
Example 4: how to access dataframe row by datetime index
df.loc['2008-01-01']