Path: blob/master/10_Deleting/Iris/Solutions.ipynb
613 views
Kernel: Python 2
Iris
Introduction:
This exercise may seem a little bit strange, but keep doing it.
Step 1. Import the necessary libraries
In [13]:
Step 2. Import the dataset from this address.
Step 3. Assign it to a variable called iris
In [3]:
Out[3]:
Step 4. Create columns for the dataset
In [5]:
Out[5]:
Step 5. Is there any missing value in the dataframe?
In [11]:
Out[11]:
sepal_length 0
sepal_width 0
petal_length 0
petal_width 0
class 0
dtype: int64
Step 6. Lets set the values of the rows 10 to 29 of the column 'petal_length' to NaN
In [36]:
Out[36]:
Step 7. Good, now lets substitute the NaN values to 1.0
In [39]:
Out[39]:
Step 8. Now let's delete the column class
In [40]:
Out[40]:
Step 9. Set the first 3 rows as NaN
In [52]:
Out[52]:
Step 10. Delete the rows that have NaN
In [53]:
Out[53]:
Step 11. Reset the index so it begins with 0 again
In [56]:
Out[56]:
BONUS: Create your own question and answer it.
In [ ]: