1.
Getting & Knowing Your Data
Step 1. Import the necessary libraries
Step 2. Import the dataset from this
[Link]
Step 3. Assign it to a variable called chipo.
Step 4. See the first 10 entries
Step 5. What is the number of observations in the dataset?
Step 6. What is the number of columns in the dataset?
Step 7. Print the name of all the columns.
Step 8. How is the dataset indexed?
Step 9. Which was the most ordered item?
Step 10. How many items were ordered?
Step 11. What was the most ordered item in the choice_description column?
Step 12. How many items were orderd in total?
Step 13. Turn the item price into a float
Step 14. How much was the revenue for the period in the dataset?
Step 15. How many orders were made in the period?
Step 16. What is the average amount per order?
Step 17. How many different items are sold?
2. Filtering & Sorting
Step 1. Import the necessary libraries
Step 2. Import the dataset from this
[Link]
Step 3. Assign it to a variable called chipo.
Step 4. How many products cost more than $10.00?
Step 5. What is the price of each item?
print a data frame with only two columns item_name and item_price
Step 6. Sort by the name of the item
Step 7. What was the quantity of the most expensive item ordered?
Step 8. How many times were a Veggie Salad Bowl ordered?
Step 9. How many times people orderd more than one Canned Soda?
3. Grouping
Step 1. Import the necessary libraries
Step 2. Import the dataset from this
[Link]
Step 3. Assign it to a variable called users.
Step 4. Discover what is the mean age per occupation
Step 5. Discover the Male ratio per occupation and sort it from the most to the least
Step 6. For each occupation, calculate the minimum and maximum ages
Step 7. For each combination of occupation and gender, calculate the mean age
Step 8. For each occupation present the percentage of women and men
4. Merge
Step 1. Import the necessary libraries
Step 2. Create the 3 DataFrames based on the followin raw data
raw_data_1 = {
'subject_id': ['1', '2', '3', '4', '5'],
'first_name': ['Alex', 'Amy', 'Allen', 'Alice', 'Ayoung'],
'last_name': ['Anderson', 'Ackerman', 'Ali', 'Aoni', 'Atiches']}
raw_data_2 = {
'subject_id': ['4', '5', '6', '7', '8'],
'first_name': ['Billy', 'Brian', 'Bran', 'Bryce', 'Betty'],
'last_name': ['Bonder', 'Black', 'Balwner', 'Brice', 'Btisan']}
raw_data_3 = {
'subject_id': ['1', '2', '3', '4', '5', '7', '8', '9', '10', '11'],
'test_id': [51, 15, 15, 61, 16, 14, 15, 1, 61, 16]}
Step 3. Assign each to a variable called data1, data2, data3
Step 4. Join the two dataframes along rows and assign all_data
Step 5. Join the two dataframes along columns and assing to all_data_col
Step 6. Print data3
Step 7. Merge all_data and data3 along the subject_id value
Step 8. Merge only the data that has the same 'subject_id' on both data1 and data2
Step 9. Merge all values in data1 and data2, with matching records from both sides where
available.
5. Deleting
This exercise may seem a little bit strange, but keep doing it
Step 1. Import the necessary libraries
Step 2. Import the dataset from this
[Link]
Step 3. Assign it to a variable called iris
Step 4. Create columns for the dataset
1. sepal_length (in cm)
2. sepal_width (in cm)
3. petal_length (in cm)
4. petal_width (in cm)
5. class
Step 5. Is there any missing value in the dataframe?
Step 6. Lets set the values of the rows 10 to 29 of the column 'petal_length' to NaN
Step 7. Good, now lets substitute the NaN values to 1.0
Step 8. Now let's delete the column class
Step 9. Set the first 3 rows as NaN
Step 10. Delete the rows that have NaN
Step 11. Reset the index so it begins with 0 again
Create your own question and answer it.