I recently had to update the virtual environment for one of my libraries from Python 3.7 to 3.10, which also involved updating Pandas from 1.1.5 to 2.3.0. In the previous virtual environment, this used to work fine (my_index is a string): index_df = dict(tuple(fixing_df.groupby(['name'])))[my_index] After updating the virtual environment, this line was causing a bug (KeyError), and the following solution worked: my_index = (my_index,) index_df = dict(tuple(fixing_df.groupby(['name'])))[my_index] In other words, somehow, the dictionary key changed its format after swithcing the virtual environment. Whilst I temporarily fixed the issue as described above, I am still trying to understand what's raally causing this strange behavior. Would anyone be able to point me in the right direction? Continue reading...