



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




1. Import pandas as pd Import numpy as np Import matplotlib.pyplot as plt 2. Data = pd.read_excel(‘D598 Data Set.xlsx) 3. duplicates = data.duplicated() 4. duplicates 5. data[duplicates]
Caitlin Atkins D598 – Analytics Programming Task 3: Presentation A. Explain how the code works for the program you submitted in Task 2. Before performing data analysis, importing Python language libraries capable of specific performances is essential. Pandas are used in nearly every data analysis document because of their ability to manipulate data and read, clean, filter, and group files. While NumPy was not used during this task, it is helpful for numerical computing and data processing. Finally, matplotlib is essential for data visualizations. To load the Excel file into the data frame, pd.read_excel() is used. The title of the data file is included in parentheses. The file is then named to be called on throughout the analysis. These code lines are used to identify any duplicates in the data frame. First, a
6. gdata = data.groupby('Business State').mean(numeric_only=True) 7. gdata 8. grouped_data = gdata.agg(['mean', 'median', 'min', 'max']) 9. print(grouped_data) 10. new_dataframe = grouped_data Boolean series identifies duplicate columns and marks them as a variable named ‘duplicates. After, duplicates are used to display those duplicate items. Finally, data[duplicates] retrieves the duplicate rows in the data frame. Using these lines, the data frame will be grouped by state; the mean for each column will be calculated, and only numeric values will be displayed. Gdata will print the new data frame based on the previous line of code.
This pie chart shows the distribution of businesses in each business state. This is a bar chart that shows the total revenue in each business state.