Computer scienceData scienceInstrumentsVisualizationMatplotlib overview

Numeric data visualization

Preprocess the data

Report a typo

You've got a dataset from a music shop. It contains information on customers, ukuleles, and guitars sold each month during a year. Here's what it looks like:

+----+---------+-------------+------------+-----------+
|    |   month |   customers |   ukuleles |   guitars |
|----+---------+-------------+------------+-----------|
|  0 |       1 |         252 |         30 |       NaN |
|  1 |       2 |         311 |         32 |        17 |
|  2 |       3 |         304 |         34 |        19 |
|  3 |       4 |         290 |         30 |       Nan |
|  4 |       5 |         317 |         39 |        20 |
+----+---------+-------------+------------+-----------+

However, there are some NaN values. Before you plot the data, you need to preprocess it: remove all the NaN rows and get rid of the month column (since we won't need it for further analysis, be it univariate or bivariate distribution). Do it and print the resulting dataset.

Sample Input 1:

Sample Output 1:

    customers  ukuleles  guitars
1         311      32.0     17.0
2         304      34.0     19.0
4         317      39.0     20.0
5         301      30.0     25.0
6         307      30.0     28.0
7         312      33.0     19.0
9         286      38.0     23.0
10        310      32.0     26.0
Write a program in Python 3
import pandas as pd

music = pd.DataFrame({
"month":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
"customers": [252, 311, 304, 290, 317, 301, 307, 312, 299, 286, 310, 315],
"ukuleles": [30, 32, 34, 30, 39, 30, 30, 33, None, 38, 32, None],
"guitars": [None, 17, 19, None, 20, 25, 28, 19, 20, 23, 26, 29]})

# your code here
print()
___

Create a free account to access the full topic