Styling DataFrames

Learn how to style a DataFrame.

Loading the data

Now that we have the basic data, we’re going to do some aggregations and column creation. Let’s see if we can go through the following code and figure out what it’s doing. We’ll go through the explanation right after showing it, but we recommend that after going through this course, you should start practicing reading code and ensuring that you understand what it’s doing.

Please login to launch live app!

There might have been a curveball in here—the sparklines library. Let’s skip that for now and describe the rest of the chain.

Group by the months in the index (note that we’re using named aggregations and that, as the comment states, the result of the resample method does not support named aggregations). For each group, calculate the median of the cfs column, calculate total_flow from the cfs column (it’s the 15-minute value, so we multiply it by 15 to get the minutes and 60 to get the seconds), and create a flow_trend column that uses sparklines.

After grouping, we’re going to make some more columns. The “quarterly_flow” column resamples our monthly ...