Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot rename Columns in df
#1
Greetings!
I need to rename Columns in the Dataframe. I found if the name has a space my script is failing.
I tried a lot of examples from the Net and nothing is working for some reason. Column Names are staying the same. Sad
here is a "renaming" snippet:
exlf = pd.read_excel('C:/01/XLS_Files/SHORT.xlsx', keep_default_na=False)
exlf = exlf.rename(columns={"Visual ID": "Visual_ID","VR Duration(Days)": "VR_D"})
print(exlf)
Thank you.
Reply


Messages In This Thread
Cannot rename Columns in df - by tester_V - Aug-25-2023, 04:59 PM
RE: Cannot rename Columns in df - by deanhystad - Aug-25-2023, 05:16 PM
RE: Cannot rename Columns in df - by tester_V - Aug-25-2023, 06:30 PM
RE: Cannot rename Columns in df - by snippsat - Aug-25-2023, 06:59 PM
RE: Cannot rename Columns in df - by tester_V - Aug-25-2023, 07:38 PM
RE: Cannot rename Columns in df - by snippsat - Aug-25-2023, 08:01 PM
RE: Cannot rename Columns in df - by tester_V - Aug-25-2023, 10:34 PM
RE: Cannot rename Columns in df - by snippsat - Aug-26-2023, 12:28 AM
RE: Cannot rename Columns in df - by deanhystad - Aug-26-2023, 01:16 AM
RE: Cannot rename Columns in df - by tester_V - Aug-26-2023, 03:50 AM
RE: Cannot rename Columns in df - by deanhystad - Aug-26-2023, 10:40 PM
RE: Cannot rename Columns in df - by perfringo - Aug-27-2023, 06:10 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to rename dataframe columns based on the content in an index? ar_mahdavi 2 2,576 Jun-07-2021, 06:09 AM
Last Post: ricslato

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020