:
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...columns=['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...,因为是索引,所以,会按照索引的规则取值,如:[1:5] 会取出 1,2,3,4 这4个值。