import pandas as pd
import numpy as np
df = pd.read_excel( r"E:\a研究生学习\项目\数据\h2.xlsx")
print(df)
print(df.dtypes)
m1 m2 m3 m4
0 6082 80 2 3
1 2132 80 4 3
2 9857 80 2 1
3 6543 80 4 3
4 8628 80 4 3
5 6696 80 3 3
6 6738 80 2 1
7 1843 80 3 2
8 7362 443 1 3
9 8347 80 2 3
10 47 80 3 2
11 4348 443 2 2
12 6412 80 1 2
13 8965 80 1 1
14 4089 80 3 1
15 762 80 2 3
16 3019 80 2 3
17 8902 80 2 3
m1 int64
m2 int64
m3 int64
m4 int64
dtype: object
print(df['m3'])
0 2
1 4
2 2
3 4
4 4
5 3
6 2
7 3
8 1
9 2
10 3
11 2
12 1
13 1
14 3
15 2
16 2
17 2
Name: m3, dtype: int64
data=df.iloc[0].values
print(data)
[6082 80 2 3]
data=df.iloc[[1,2,3]].values
print(data)
[[2132 80 4 3]
[9857 80 2 1]
[6543 80 4 3]]
data=df.iloc[2:6,:].values
print(data)
[[9857 80 2 1]
[6543 80 4 3]
[8628 80 4 3]
[6696 80 3 3]]
data=df.iloc[:,2:4].values
print(data)
[[2 3]
[4 3]
[2 1]
[4 3]
[4 3]
[3 3]
[2 1]
[3 2]
[1 3]
[2 3]
[3 2]
[2 2]
[1 2]
[1 1]
[3 1]
[2 3]
[2 3]
[2 3]]
data=df.iloc[2:6,2:4]
print(data)
m3 m4
2 2 1
3 4 3
4 4 3
5 3 3
|