You only need to remove the index name , use rename_axis (new in pandas 0.18.0 ):
print (reshaped_df) sale_product_id 1 8 52 312 315 sale_user_id 1 1 1 1 5 1 print (reshaped_df.index.name) sale_user_id print (reshaped_df.rename_axis(None)) sale_product_id 1 8 52 312 315 1 1 1 1 5 1
Another solution working in 0.18.0 below 0.18.0 :
reshaped_df.index.name = None print (reshaped_df) sale_product_id 1 8 52 312 315 1 1 1 1 5 1
If necessary, also delete columns name :
print (reshaped_df.columns.name) sale_product_id print (reshaped_df.rename_axis(None).rename_axis(None, axis=1)) 1 8 52 312 315 1 1 1 1 5 1
Another solution:
reshaped_df.columns.name = None reshaped_df.index.name = None print (reshaped_df) 1 8 52 312 315 1 1 1 1 5 1
EDIT by comment:
You need reset_index with drop=True parameter:
reshaped_df = reshaped_df.reset_index(drop=True) print (reshaped_df) sale_product_id 1 8 52 312 315 0 1 1 1 5 1 #if need reset index nad remove column name reshaped_df = reshaped_df.reset_index(drop=True).rename_axis(None, axis=1) print (reshaped_df) 1 8 52 312 315 0 1 1 1 5 1
If necessary, remove only the column name:
reshaped_df = reshaped_df.rename_axis(None, axis=1) print (reshaped_df) 1 8 52 312 315 sale_user_id 1 1 1 1 5 1
Edit1:
So if you need to create a new column from index and delete columns names :
reshaped_df = reshaped_df.rename_axis(None, axis=1).reset_index() print (reshaped_df) sale_user_id 1 8 52 312 315 0 1 1 1 1 5 1
source share