-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic1.py
41 lines (36 loc) · 957 Bytes
/
basic1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os
import matplotlib.pyplot as plt
import pandas as pd
os.chdir("C:\Users\cyberkitsune096\Documents\Water_Quality_Project")
csv_file='testdata_1.csv'
# Load data
data = pd.read_csv('csv_file')
'''
# Plot
plt.figure(figsize=(6.8, 4.2))
x = range(len(data['month']))
plt.plot(x, data['sales'])
plt.xticks(x, data['month'])
plt.xlabel('Month')
plt.ylabel('Sales')
plt.show()
'''
df =pd.read_csv('filename.csv', sep=',')
months = {'jan':1,
'feb':2,
'mar':3,
'apr':4,
'may':5,
'jun':6,
'jul':7,
'aug':8,
'sep':9,
'oct':10,
'nov':11,
'dec':12
}
plt.plot(df['month'].replace(months), df['sales'], label='sales')
plt.plot(df['month'].replace(months), df['expenditure'], label='expenditure')
plt.gca().set_xticks(list(months.values()))
plt.gca().set_xticklabels(list(months.keys()))
plt.legend()