Unit 35Ordering and Describing Data

Having the data in a frame is not enough. What we need next is a yardstick that ranks and describes the data that we have. The universal Python yardstick, len, and its brethren, min and max, are a good starting point, but often we want answers to more questions, aside from How many? and How much? pandas provides a number of functions for sorting, ranking, counting, membership testing, and getting descriptive statistics.

Sorting and Ranking

Series and frames can be sorted by index or by value (values). The sort_index function returns a frame sorted by the index (it doesn’t work for series). The sorting order is always lexicographic (numeric for numbers, alphabetic for strings), and you can use the ascending ...

Get Data Science Essentials in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.