I'm working with an xlsx-file which looks like this:
My previous task was to modify the columns named 'Entry 1' and 'Entry 2'. I have stored those columns in a seperate slice of the original dataframe for better overview. I'll give you a quick glimpse how this slice looks:
>>> slice = df.loc[:, 'Entry 1':'Entry 2']
# code to modify the values
>>> slice
Entry 1 Entry 2
1 Modified 1 Value 1
2 Modified 2 Value 2
3 Modified 3 Value 3
I now want to overwrite those columns in the original dataframe with the named slice. I already achieved this by using the following:
df.loc[:, 'Entry1':'Entry2'] = slice
Question
As you can see, the header of the columns has a special format. How do I overwrite the values in 'Entry1' and 'Entry2', excluding the header, to keep the format?







