Open ameliameyer opened 2 years ago
Hi, Probably its because of different version of python or pandas library which now not allow default sorting. Now, if you want above output then you have to use different command.
Following is from panda release note https://pandas.pydata.org/docs/whatsnew/v0.23.0.html#whatsnew-0230-api-breaking-dict-insertion-order
Python version 3.6 and later, dicts are ordered by insertion order, see PEP 468
If you wish to retain the old behavior while using Python >= 3.6, you can use .sort_index():
pd.Series({2:'a', 1:'b', 3:'c'}).sort_index()
Under Ch 3: Introducing Pandas Objects, the output shown is different than the output I get when I run the same line of code:
As written in the book:
Whereas when I run the code:
Is there something weird going on with my system or is there an error in the text?