** ▼ Code **
df = pd.DataFrame([
['a0','b0','c0'],
['a1','b1','c1'],
['a2','b2','c2'],
['a3','b3','c3'],
],
columns=['a','b','c'],
index=[0,1,2,3]
)
df
** ▼ Output result **
** ▼ Code **
#Case using loc
df.loc[[0,2],['a','c']]
#Case using iloc
df.iloc[[0,2],[0,2]]
** ▼ Output result **
** ▼ Code **
df.index
** ▼ Output result **
** ▼ Code **
df.columns
** ▼ Output result **
Recommended Posts