Source Code:
(back to article)
import pandas as pd # Create a sample DataFrame df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]}, index=[100, 101, 102]) # Convert index to column df.reset_index(inplace=True, name='Index_Column') print(df)
Result:
Report an issue