Ok, now I understand, thanks for the comments!

So inplace=True should return None and make the change in the original object. It seemed that on listing the dataframe again, no changes were present.

But of course I should not have assigned the return value to the dataframe, i.e.

testDataframe = testDataframe.set_index(['Codering'], inplace=True)

should just be

testDataframe.set_index(['Codering'], inplace=True)

or

testDataframe = testDataframe.set_index(['Codering'], inplace=False)

otherwise the return value of the inplace index change (None) is the new content of the dataframe which is of course not the intend.

I am sure this is obvious to many and now it is to me as well but it wasn't without your help, thanks!!!

Answer from Wouter on Stack Overflow
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.set_index.html
pandas.DataFrame.set_index — pandas 3.0.3 documentation
DataFrame.set_index(keys, *, drop=True, append=False, inplace=False, verify_integrity=<no_default>)[source]#
🌐
Note.nkmk.me
note.nkmk.me › home › python › pandas
pandas: Set a column as the DataFrame index with set_index() | note.nkmk.me
January 26, 2024 - df.set_index('name', inplace=True) print(df) # age state point # name # Alice 24 NY 64 # Bob 42 CA 92 # Charlie 18 CA 70 # Dave 68 TX 70 # Ellen 24 CA 88 # Frank 30 NY 57 ... When reading a CSV file into a DataFrame with pd.read_csv(), you can directly set a column as the index by specifying its column number in the index_col argument. ... df_name = pd.read_csv('data/src/sample_pandas_normal.csv', index_col=0) print(df_name) # age state point # name # Alice 24 NY 64 # Bob 42 CA 92 # Charlie 18 CA 70 # Dave 68 TX 70 # Ellen 24 CA 88 # Frank 30 NY 57
🌐
Sharp Sight
sharpsight.ai › blog › pandas-set-index
How to Use the Pandas Set Index Method - Sharp Sight
March 30, 2022 - If you want to directly modify the original DataFrame, you need to set inplace = True. I’ll show you an example of this in the examples section. As I just mentioned above, the set_index method produces a new Pandas DataFrame by default.
🌐
W3Schools
w3schools.com › python › pandas › ref_df_set_index.asp
Pandas DataFrame set_index() Method
import pandas as pd data = { "name": ... newdf = df.set_index('name') Try it Yourself » · The set_index() method allows one or more column values become the row index. dataframe.set_index(keys, drop, append, inplace, ...
🌐
Skytowner
skytowner.com › explore › pandas_dataframe_set_index_method
Pandas DataFrame | set_index method with Examples
By default, inplace=False. ... If True, then an error is raised if the new index has duplicates. If False, then duplicate indexes are allowed. By default, verify_integrity=False. A DataFrame with a new index. ... Here, the name assigned to the index is the column label, that is, "A". ... Here, the DataFrame ends up with 2 indexes. To keep the column that will be used as the index, set drop=False:
🌐
Vultr Docs
docs.vultr.com › python › third-party › pandas › DataFrame › set_index
Python Pandas DataFrame set_index() - Set DataFrame Index | Vultr Docs
December 24, 2024 - Understand that set_index() by default returns a new DataFrame unless specified otherwise. Use the inplace=True flag to modify the DataFrame in place.
🌐
Appdividend
appdividend.com › 2019 › 01 › 26 › pandas-set-index-example-python-set_index-tutorial
Pandas DataFrame set_index(): Setting an Index Column
September 23, 2025 - If you don’t want a new DataFrame after setting an index and modifying the existing one, pass inplace=True as an argument to the method. import pandas as pd df = pd.DataFrame( { 'ID': [101, 102, 103, 104, 105, 106, 107], 'Team_Name': ["Lakers", "Patriots", "Yankees", "Lakers", "Red Sox", "Warriors", "Patriots"], 'Wins': [12, 10, 14, 12, 13, 15, 18] } ) df.set_index("ID", inplace=True) print(df) That’s all!
Find elsewhere
🌐
Medium
medium.com › @heyamit10 › understanding-set-index-in-pandas-24a39ec2a0b9
Understanding set_index() in Pandas | by Hey Amit | Medium
March 6, 2025 - Here’s something that might surprise you: By default, set_index() doesn’t change your original DataFrame. It returns a new one. But if you want to make the change permanent, you can use the inplace=True parameter.
🌐
GitHub
github.com › pandas-dev › pandas › issues › 18979
Default value of df.set_index()'s argument 'inplace' should be True. · Issue #18979 · pandas-dev/pandas
December 28, 2017 - import pandas as pd #start from ... dataframe print(df.head()) #....but it's the same · df.set_index() has an 'inplace' argument, with a default value of 'False'....
Author   pandas-dev
🌐
PYnative
pynative.com › home › python › pandas › set index in pandas dataframe
Set index in pandas DataFrame
March 9, 2023 - In the above examples, whenever we executed DataFrame.set_index() operation, pandas created a new copy of DataFrame because the modification is not-in place. Specify inplace=True to set index in the existing DataFrame rather than creating a copy of it.
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.reset_index.html
pandas.DataFrame.reset_index — pandas 3.0.3 documentation
DataFrame.reset_index(level=None, *, drop=False, inplace=False, col_level=0, col_fill='', allow_duplicates=<no_default>, names=None)[source]#
🌐
GeeksforGeeks
geeksforgeeks.org › pandas › python-pandas-dataframe-set_index
Python | Pandas DataFrame.set_index() - GeeksforGeeks
July 11, 2025 - Now we are using Pandas DataFrame.set_index() to set a Single Column as Index. ... data.set_index("First Name", inplace=True) print("\nEmployee Dataset with 'First Name' as Index:") display(data.head(5))
🌐
Saturn Cloud
saturncloud.io › blog › how-to-change-index-value-in-pandas-dataframe
How to Change Index Value in Pandas Dataframe | Saturn Cloud Blog
June 19, 2023 - The inplace=True parameter is used to modify the dataframe in place, without creating a new dataframe. ... The reset_index() method is used to reset the index of a Pandas dataframe to the default integer index.
🌐
Pandas
pandas.pydata.org › pandas-docs › version › 0.24.0rc1 › api › generated › pandas.DataFrame.set_index.html
pandas.DataFrame.set_index — pandas 0.24.0rc1 documentation
Extending Pandas · Release Notes · Enter search terms or a module, class or function name. DataFrame.set_index(keys, drop=True, append=False, inplace=False, verify_integrity=False)[source]¶ · Set the DataFrame index using existing columns. Set the DataFrame index (row labels) using one or more existing columns.
🌐
Programiz
programiz.com › python-programming › pandas › methods › set_index
Pandas set_index()
The syntax of the set_index() method in Pandas is: df.set_index(keys, drop=True, append=False, inplace=False, verify_integrity=False)
🌐
Pandas
pandas.pydata.org › pandas-docs › version › 0.17.0 › generated › pandas.DataFrame.set_index.html
pandas.DataFrame.set_index — pandas 0.17.0 documentation
DataFrame.set_index(keys, drop=True, append=False, inplace=False, verify_integrity=False)¶ · Set the DataFrame index (row labels) using one or more existing columns. By default yields a new object. Examples · >>> indexed_df = df.set_index(['A', 'B']) >>> indexed_df2 = df.set_index(['A', [0, 1, 2, 0, 1, 2]]) >>> indexed_df3 = df.set_index([[0, 1, 2, 0, 1, 2]]) index · modules | next | previous | pandas 0.17.0 documentation » ·
🌐
w3resource
w3resource.com › pandas › dataframe › dataframe-set_index.php
Pandas DataFrame: set_index() function - w3resource
August 19, 2022 - DataFrame.set_index(self, keys, drop=True, append=False, inplace=False, verify_integrity=False) Parameters: Returns: DataFrame Changed row labels. Example: Download the Pandas DataFrame Notebooks from here. PREV : DataFrame - set_axis() function NEXT : DataFrame - take() function  ·
🌐
GitHub
github.com › dask › dask › issues › 4484
Dataframe set_index(inplace=True) doesn't work · Issue #4484 · dask/dask
February 14, 2019 - Dataframe set_index(inplace=True) doesn't work#4484 · Copy link · smangham · opened · on Feb 14, 2019 · Issue body actions · Fairly straightforward one, but I may have done something stupid: import pandas as pd import dask.dataframe as dd df = pd.DataFrame({ 'a': [9, 8, 7], 'b': [6, 5, 4], 'c': [3, 2, 1] }) ddf = dd.from_pandas(df, npartitions=1) print('Rows: {}'.format(df.index.values)) df.set_index('a', inplace=True) print('Pandas: {}'.format(df.index.values)) ddf.set_index('a', inplace=True) print('Dask - inplace=True: {}'.format(ddf.index.values.compute())) ddf = ddf.set_index('a') print('Dask: {}'.format(ddf.index.values.compute())) The output for this is: Rows: [0 1 2] Pandas: [9 8 7] Dask - inplace=True: [0 1 2] Dask: [7 8 9] So set_index(col, inplace=True) doesn't work.
Author   dask