-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathselect_data.py
More file actions
23 lines (16 loc) · 750 Bytes
/
select_data.py
File metadata and controls
23 lines (16 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# select_data.py
import pandas as pd
import numpy as np
series1 = pd.Series([1, 2, 3, 4, 5, 6, 7],
index=["C", "D", "E", "F", "G", "A", "B"])
print("series1['E'] = {} \n".format(series1['E']));
print("series1.E = {} \n".format(series1.E));
df1 = pd.DataFrame({"note" : ["C", "D", "E", "F", "G", "A", "B"],
"weekday": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]},
index=['1', '2', '3', '4', '5', '6', '7'])
print("df1.loc['2']:\n{}\n".format(df1.loc['2']))
print("series1.loc['E':'A']=\n{}\n".format(series1.loc['E':'A']));
print("df1.iloc[2:4]=\n{}\n".format(df1.iloc[2:4]))
print("series1.at['E']={}\n".format(series1.at['E']));
print("df1.iat[4,1]={}\n".format(df1.iat[4,1]))
index = pd.Index(['C','D','E','F','G','A','B'])