In this video, learn how to use unstack().
- [Instructor] With unstack,…we return a series or a DataFrame.…Because the NAN values,…or the missing data values are displayed,…you have the option to fill them with another value.…So, in the example of the Olympic data set…that we are working on, it would make sense to have…every NAN value to be zero, because that means that…there were no medals won for that event.…With unstacking, you can pivot a level of the index labels,…and this returns a DataFrame…having a new level of column labels.…If the index isn't a MultiIndex,…the output will be a series,…and the level involved will automatically get sorted.…
Let's head over to our Jupyter Notebook…to look at unstacking.…So, remember that our original DataFrame is df,…and, when we do an unstack, what we're looking at…is to try and get a wider DataFrame.…So, if i do a df.unstack,…I expect this original DataFrame, df, to widen out.…And, as with stacking, I prefer to explicitly state…which column I'm doing the unstacking on.…In this case, it's Gender.…
So, I type df.unstack, and enter the column name,…
- Working with plots
- Boolean indexing
- String handling
- Grouping data
- Creating your own colormaps
Skill Level Intermediate
1. Technical Setup
2. Series and DataFrames
3. Data Input and Validation
4. Basic Analysis
5. Basic Plotting
9. Data Visualizations
Next steps1m 1s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.