Loading tutorials
sort_values on a single column. Here you will sort on several columns at once, choose the direction for each column, and avoid the mistakes that come up most often.5 min readsort_values on one or more columns. It covers what happens to missing values (NaN) during a sort, how to move them, and how the same rule affects related tools such as nlargest and rank.5 min readsort_index, which orders a DataFrame or Series by its row labels (or column labels) instead of by its values. It assumes you can create a DataFrame, select columns, and tell a Series from a DataFrame. It also assumes you know sort_values from the earlier chapters, because `so5 min readsort_values on one or more columns and know the difference between a Series and a DataFrame. The key argument changes what pandas compares when it orders rows. It does not change what ends up in the result.5 min readsort_values that affect results: what happens to rows that tie, and what happens to the index after a sort. It assumes you can build a DataFrame, select columns, and use sort_values with one or several columns and with ascending.5 min readnlargest and nsmallest, which pull the rows with the highest or lowest values out of a DataFrame or Series. It assumes you can already build a DataFrame, select columns, and tell a Series from a DataFrame. It also assumes you have met sort_values in the earlier chapters.4 min readsort_values and nlargest. It covers rank, which turns values into positions without reordering any rows.5 min readdescribe and the reduction methods (sum, mean, median and similar), which collapse a column into one number. The grouped summaries later in the tutorial are built from t4 min readvalue_counts answers a common question: how many times does each distinct value appear in a column? It also has several options that change what gets counted, how the result is ordered and ho5 min readgroupby splits a DataFrame into groups, applies a reduction to each group, and combines the results. It assumes you know basic Python syntax, how to create a DataFrame and select columns, and the difference between a Series and a DataFrame.5 min readgroupby(...).agg(...). It assumes you can build a DataFrame, select columns, and run a basic groupby with one aggregation such as df.groupby("region")["units"].sum(). It uses the sales table from earlier chapters, so the setup is repeated here.4 min readgroupby with named aggregation, which the previous chapter covered. Here you will put the grouped result into a useful order, deal with ties, and handle the cases where5 min readNaN) change the numbers that reductions, groupby, value_counts and pivot_table produce. It assumes you can build a DataFrame, select columns, and tell a Series from a DataFrame. It also assumes you have read the earlier chapters on describe, `groupby5 min readgroupby(...).agg(...) shrinks the data to one row per group. Sometimes you want the group statistic next to every original row instead, for example to compute each order's share of its region's total. transform does this: it computes a per-group result and returns it aligned to the original rows5 min readgroupby with agg from the previous chapters. Here you will turn a grouped summary into a cross-tabulated table. Rows hold one category, columns hold another, and each cell holds an aggregate.4 min read