E22. The moves data-set is supposed to contain asingle entry for each Pokemon move. To see if this is true, wecompare the number of unique rows in the Name column withthe number of rows in the data-set. If they're the same, then eachmove is unique and we're good! If not, then somehow some duplicaterows got into the data-set.
DIsplay the number of rows in the data-set usingthe shape attribute.
Display the number of unique names in the Name columnusing nunique. It should match the number reportedby shape.
E23. The Level column contains a bunch of garbagedata. We can delete a column from our DataFrame usingthe drop function. First, take a look at the examples ofhow to use the drop function in the official pandasdocumentation. Then, copy and paste the code given below and runit. The first line will delete the Level column from ourdataframe.
E24. You may have noticed that several of the columns inthe moves data-set contain a bunchof NaN values. Call isna().sum() on theDataFrame to count the number of NaN values in eachcolumn. This will give us a better idea as to where the holes(NaN values) are in the data-set.
E25. Use the fillna function to replace all ofthe NaN values in the DataFrame with 0.
E26. Use the groupby function to display the uniquevalues in the Type column, and how many of each valuethere are in the data-set.
E27. Now use the value_counts() function to displaythe unique values in the Type column, and how many ofeach value there are in the data-set.
E28. Display the average Power for each of thedifferent types of moves. The output should resemble thefollowing:
E29. Display the average Accuracy of each type indescending order. The output should resemble the following:
E30. Some of those averages look a little low. Create ahistogram of the Power attribute using 10 bins.
E31. It looks like there are many moves with a power of 0. Thisis probably because we replaced a bunch of NaNs with 0. Createa histogram of all moves with a power greater than 0. As before,use 10 bins.
E22. The moves data-set is supposed to contain a single entry for each Pokemon move. To see if this is true, we compare
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am