Getting Started Open the file called /WMPython/Module4/HistAssignment.py, which was provided with the course files, and save it in the /WMPython/MyWork folder. Also, copy the data file named /WMPython/Module4/length.csv into the /WMPython/MyWork folder. That data file contains, on separate lines, the number of characters in 32,826 of President Donald Trump’s tweets on Twitter. Assignment • Import the data from length.csv into Python. • Plot a histogram of the data using a bar graph from matplotlib. • Assign your data for the x and y axes to lists using the names x and y, respectively. • Create captions on the x-axis and y-axis of “Number of Characters” and “Frequency,” respectively. • Present the data with the x-axis data, which represents the number of characters, in sequential order: do not sort by frequency of occurrence. • Create a title for the graph: “Analysis of President Trump’s Tweet Length” • For this exercise, do not worry about making the x-axis labels legible. However, if you want an extra challenge, then do your best to create a legible set of x-axis labels by using some of the techniques shown in the session videos: o changing the size of the graph, or o reducing the number of labels shown on the graph • It is required that you use the variable names specified in the assignment statement above in your code. Part of the assessment requires that I run your code and look for the values of those variables. If you use other variable names, then I cannot find your answer. • Use the matplotlib package to create a .jpg file of your graph and call it Hist.jpg. What to think about as you write your program: This assignment integrates these new concepts: • Summarizing data in histogram from using a dictionary to create frequency data. • Finding the maximum and minimum values in a list for the number of characters in the set of tweets. • Initializing an empty dictionary. • Graphing with matplotlib bar charts. Submission: Submit the HistAssignment.py file by clicking on the assignment link above and following the same instructions as described for the submission of M1Assignment.ipynb
Any citation style (APA, MLA, Chicago/Turabian, Harvard)
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.