#!/usr/bin/env python # coding: utf-8 # # Wine # ### Introduction: # # This exercise is a adaptation from the UCI Wine dataset. # The only pupose is to practice deleting data with pandas. # # ### Step 1. Import the necessary libraries # In[2]: # ### Step 2. Import the dataset from this [address](https://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data). # ### Step 3. Assign it to a variable called wine # In[3]: # ### Step 4. Delete the first, fourth, seventh, nineth, eleventh, thirteenth and fourteenth columns # In[4]: # ### Step 5. Assign the columns as below: # # The attributes are (donated by Riccardo Leardi, riclea '@' anchem.unige.it): # 1) alcohol # 2) malic_acid # 3) alcalinity_of_ash # 4) magnesium # 5) flavanoids # 6) proanthocyanins # 7) hue # In[5]: # ### Step 6. Set the values of the first 3 rows from alcohol as NaN # In[6]: # ### Step 7. Now set the value of the rows 3 and 4 of magnesium as NaN # In[7]: # ### Step 8. Fill the value of NaN with the number 10 in alcohol and 100 in magnesium # In[8]: # ### Step 9. Count the number of missing values # In[9]: # ### Step 10. Create an array of 10 random numbers up until 10 # In[10]: # ### Step 11. Use random numbers you generated as an index and assign NaN value to each of cell. # In[11]: # ### Step 12. How many missing values do we have? # In[12]: # ### Step 13. Delete the rows that contain missing values # In[13]: # ### Step 14. Print only the non-null values in alcohol # In[14]: # In[15]: # ### Step 15. Reset the index, so it starts with 0 again # In[16]: # ### BONUS: Create your own question and answer it. # In[ ]: