Question
data set : https://www.kaggle.com/datasets/neuromusic/avocado-prices Code : must be written in python language under Jupyter Q13) Drop rows that have a region of TotalUS, and then
data set : https://www.kaggle.com/datasets/neuromusic/avocado-prices Code : must be written in python language under Jupyter
Q13) Drop rows that have a region of TotalUS, and then check to see how many rows were dropped.
Q14) Drop the Unnamed: 0, 4046, 4225, and 4770 columns. (point: 2)
Q15) Notice that the column names are inconsistent. Use dictionary comprehension (similar to list comprehension, but for dictionaries) to create a dictionary where the keys are the column names with a space between the words and values as the column names without the space. Use this dictionary to rename the columns of the dataframe.
Q16) Group, sum, and unstack this data to produce a DataFrame that looks like this: (point: 10)
Q17) Convert the Date column to the datetime type. Filter the data so it contains just the rows for 2015, for the conventional type, and for the region named Albany. Store just the Date, Total Bags, and Small Bags columns in a new DataFrame. (point: 10)
Q18) Melt the data in the Total Bags and Small Bags columns, but not the values in the Date column. Name the column that contains the type of bag Bags, and name the column that contains the number of bags Count. Then, display the resulting DataFrame.
Q19) Plot the melted data with Seaborn in a line plot, using the hue parameter to distinguish between the bag types.
Q20) Bin the data in the Total Volume column into four quantiles labeled poor, modest, good, and excellent, and store the bin labels in a new column. (point: 10)
Q21) Plot the binned data by year using a Seaborn count plot.
Q22) Of the three bag sizes, which size sells the most? Hint: Melt the three bag size columns and plot the bags by year. (point: 10) Q23) Which type of avocado sells the most?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started