Description
Exercise Set 4 – Pandas & Matplotlib
Use the sales data.csv dataset included.
Pandas quick overview: https://pandas.pydata.org/pandas-docs/stable/ getting_started/overview.html
Matplotlib tutorials: https://matplotlib.org/3.1.1/tutorials/index.html
- Read Total profit of all months and show it using a line plot
- Get Total profit of all months and show line plot with the following Style properties:
label = ’Profit data of last year’; color=’r’; marker=’o’; markerfacecolor=’k’; linestyle=’–’; linewidth=3.
- Read all product sales data and show it using a multiline plot
- Read toothpaste sales data of each month and show it using a scatter plot
- Read sales data of bathing soap of all months and show it using a bar chart. Save this plot to your hard disk
- Read the total profit of each month and show it using the histogram to see most common profit ranges
- Read Bathing soap facewash of all months and display it using the Subplot
1
Exercise Set 5 – JSON
Use the ’states.json’ file included.
Quick overview at https://realpython.com/python-json/ For the following exercises, assume a generic object or define a specific one, for example:
json_obj = ’{ “Name”:”David”, “Class”:”I”, “Age”:6 }’ python_obj = {
’name’: ’David’,
’class’: ’I’,
’age’: 6
}
- Write a Python program to convert JSON data to Python objects.
- Write a Python program to convert Python objects (dictionary) to JSON data.
- Write a Python program to convert Python objects into JSON strings. Print all the values.
- Write a Python program to convert Python dictionary objects (sort by key) to JSON data. Print the object members with indent level 4.
- Write a Python program to create a new JSON file from an existing JSON file. Use the included json file ’states.json’ and create a new json file that does not contain the ’area code’ field.
2



