Docsity

D598 Analytics Programming Task 3 Analytics Programming Presentation and Code Explanation, Exams of Advanced Education

Toggle sidebar
bg1
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]
D598 Analytics Programming Task 3: Analytics
Programming Presentation and Code Explanation 2026-
2027 Western Governors University
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
pf3
pf4
pf5

Partial preview of the text

Download D598 Analytics Programming Task 3 Analytics Programming Presentation and Code Explanation and more Exams Advanced Education in PDF only on Docsity!

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]

D598 Analytics Programming Task 3: Analytics

Programming Presentation and Code Explanation 2026 -

2027 Western Governors University

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.

  1. ax.hist(final_dataframe["Debt-to-Income Ratio"], bins=10, edgecolor='black')
  2. ax.set_title("Distribution of Debt-to-Income Ratios")
  3. ax.set_xlabel("Debt-Income Ratio")
  4. ax.set_ylabel("Frequency") This scatter plot shows the distribution between debt-to-equity vs profit margin. C. Explain how customized visualizations in part B were created. Histogram:
  5. fig, ax = plt.subplots() This is a convenient way to create a figure. Here, the figure is set to make a histogram. ‘final_dataframe[] determines the data that will be plotted. Bins set the number of bars that will be seen. Here, there will be ten bins. Edge color helps set the color of the edges of the bars so that they can be more visually appealing and straightforward to understand. These set the labels for the title, x-axis, and y-axis.
  6. plt.show() Matplotlib is used to display the figure based on the parameters set. Pie Chart:
  7. state_counts = data['Business State'].value_counts() Because the pie chart can only handle numbers, business states must be converted from a string value to a numeric value. It can be done through this code line.
  8. plt.figure(figsize=(16, 14))
  1. fig, ax = plt.subplots()
  2. ax.scatter(data["Debt to Equity"], data["Profit Margin"])
  3. ax.set_title("Debt to Equity vs. Profit Margin")
  4. ax.set_xlabel("Debt to Equity")
  5. ax.set_ylabel("Profit Margin") Matplotlib is used to display the figure based on the parameters set. Scatter Plot: This sets ‘Debt to Equity’ and ‘Profit Margin’ as the actual values in a scatter plot figure. These set the labels for the title, x-axis, and y-axis.
  6. plt.show() Matplotlib is used to display the figure based on the parameters set.