Starting from:

$30

Open Optical Networks - Python Lab 2 -Solved

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

1.    Read Total profit of all months and show it using a line plot

2.    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.

3.    Read all product sales data and show it using a multiline plot

4.    Read toothpaste sales data of each month and show it using a scatter plot

5.    Read sales data of bathing soap of all months and show it using a bar chart. Save this plot to your hard disk

6.    Read the total profit of each month and show it using the histogram to see most common profit ranges

7.    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

}

1.    Write a Python program to convert JSON data to Python objects.

2.    Write a Python program to convert Python objects (dictionary) to JSON data.

3.    Write a Python program to convert Python objects into JSON strings. Print all the values.

4.    Write a Python program to convert Python dictionary objects (sort by key) to JSON data. Print the object members with indent level 4.

5.    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

More products