-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1 Pandas.py
63 lines (22 loc) · 951 Bytes
/
1 Pandas.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import pandas as pd
prices=[[16,27,33],[42,96],[23,35,58],[50,18,39],[32,67,98],[24,67,22],[23,58],[50,18,39]]
dataframe = pd.DataFrame(prices)
print(dataframe)
print()
dataframe.fillna(0,inplace=True) ############# FILLNA################
print(dataframe)
print()
headers_dataframe = pd.DataFrame(prices,columns=['jan','feb','march'])
print(headers_dataframe)
print(headers_dataframe['jan'][3])
print(headers_dataframe.head()) #prints 1st 5 rows
print(headers_dataframe.tail()) #prints last 5 rows
print(headers_dataframe.head(3))
print(headers_dataframe.tail(3))
print()
print('Average values of January:',headers_dataframe['jan'].mean())
df = pd.DataFrame(prices,columns=['jan','feb','march'])
print()
print('Januray values when Feb values are 67 are:')
print(df['jan'][df['feb']==67])
######## CODEBASICS Pandas tutorials(look up for more)