Question

ask the user to specify the input file, ask the uscr to specify the output filc, make a plot of the fraction of the total pop

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The python code for this.

#importing pandas to read the csv file
import pandas as pd
#importing the matplotlib.pyplot for plotting
import matplotlib.pyplot as plt

# getting the name of input file
input_file_name = input("Enter the input file name ")

# setting the name of output file
output_file_name = input("Enter the file name ")

#Reading the data in input file using pandas
data = pd.read_csv(input_file_name)

# Given that the file has FractionChildren column
child_data = data['Fraction Children']

#making the plot and stroing the plot with user defined file name
plt.plot(data['Date of census'],child_data,label='Fraction Children')
plt.legend()
plt.xlabel("Date of Census")
plt.show()
plt.savefig(output_file_name)

jupyter Untitled4 Last Checkpoint: 16 minutes ago (unsaved changes) File Edit View Insert Cell Kemel dgetsHelp Logout Trusted

I can't show the output of the program because I don't have that input CSV file.

I hope you understand the above code and got the answer.

Thank you:):)

Add a comment
Know the answer?
Add Answer to:
ask the user to specify the input file, ask the uscr to specify the output filc,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT