- Replacing space ' ' in column name with '_' -> str.replace(' ', '_')
- Making all column names lowercase -> str.lower()
- Renaming columns -> .rename(columns={'old_name':'new_name'}, inplace=True)
import pandas as pd
import numpy as np
df_red = pd.read_csv('red.csv')
df_white = pd.read_csv('white.csv')
-Replacing space ' ' in column name with '_'
-Making all column names lowercase
df_red.columns = df_red.columns.str.replace(' ', '_')
df_red.columns = df_red.columns.str.lower()
df_red.head()
-Replacing space ' ' in column name with '_'
-Making all column names lowercase
df_white.columns = df_white.columns.str.replace(' ', '_')
df_white.columns = df_white.columns.str.lower()
df_white.head()