当阅读《利用Python进行数据分析》,原书中sort API的调用,因为Python3的缘故发生了更改:
查阅官方文档:
The API of sorting is changed, things becaome cleaner and more pleasant.
To sort by the values, both Series.sort() and Series.order() are DEPRECATED, replaced by the new Series.sort_values() API, Which returns a sorted Series object.
Previous | Replacement |
Series.order() | Series.sort_values() |
Series.sort() | Series.sort_value(inplace=True) |
DataFrame.sort(columns=…) | DataFrame.sort_value(by=…) |