In Lab 7, we worked through a program that displayed the homeless shelter occupancy over time. The same approach can be used for displaying any dataset where the date and time are stored. For this program, use the lab as a starting point to display public school attendance from NYC OpenData. If you would like to test your program on other data, you can filter for an individual school by viewing the data and filtering on the school number ("School DBN"). Export the file as CSV and save. There is a sample file for the high school on campus on github Modify the program from Lab 7 that displays shelter population over time to: Ask the user to specify the input file, Ask the user to specify the output file, Convert the date column (which is stored as 'YYYYMMDD') to a datetime format recognized by pandas, for example if your dataframe is df, overwrite the 'Date' column to be: df["Date"] = pd.to_datetime(df["Date"].apply(str)) Make a plot of the percent of absent students over time from the data in the input file, and Store the plot in the output file the user specified. A sample run of the program: Enter name of input file:

Respuesta :

Answer:

Explanation:

The python code to generate this is quite simple to run.

i hope you understand everything written here, you can as well try out other problems to understand better.

First to begin, we import the package;

Code:

import pandas as pd

import matplotlib.pyplot as plt

name = input('Enter name of the file: ')

op = input('Enter name of output file: ')

df = pd.read_csv(name)

df['Date'] = pd.to_datetime(df["Date"].apply(str))

plt.plot(df['Date'],df['Absent']/(df['Present']+df['Absent']+df['Released']),label="% Absent")

plt.legend(loc="upper right")

plt.xticks(rotation=20)

plt.savefig(op)

plt.show()

This should generate the data(plot) as seen in the uploaded screenshot.

thanks i hope this helps!!!

Ver imagen Preciousorekha1