Answers for "how to select columns by index in pandas"

4

pandas select column by index

#    A  B  C
# 0  1  3  5
# 1  2  4  6

column_B = a_dataframe.iloc[:, 1]
print(column_B)

# OUTPUT
# 0    3
# 1    4
Posted by: Guest on May-31-2021
2

isolate row based on index pandas

dfObj.iloc[: , [0, 2]]
Posted by: Guest on March-30-2020
2

pandas df by row index

indices = [133, 22, 19, 203, 14, 1]
df_by_indices = df.iloc[indices, :]
Posted by: Guest on October-22-2020

Code answers related to "how to select columns by index in pandas"

Python Answers by Framework

Browse Popular Code Answers by Language