:
df.loc[‘image1’:‘image10’, ‘age’:‘score’]
实例:
import numpy as np
import pandas as pd
from pandas...import Series, DataFrame
np.random.seed(666)
df = pd.DataFrame(np.random.rand(25).reshape([5, 5]), index...c1', 'c2', 'c3', 'c4', 'c5'])
print(df.shape) # (5, 5)
# 返回前五行
df.head()
# 返回后五行
df.tail()
# 访问 某几个 列...dataframe
sub_df = df[['c1', 'c3', 'c5']]
''' c1 c3 c5 A 0.700437 0.676514 0.951458 B 0.012703 0.048813...index location 用索引定位
''' c1 c3 c5 B 0.012703 0.048813 0.508066 D 0.200248 0.192892 0.293228 '''
# 过滤 列