Pandas Dataframe에서 특정 row, column 출력


# 1. subset by rows
test_df[9:13] # 9 ~ 12 row가 출력됨

# 2. reverse order dataframe
test_df[::-1] # 순서가 거꾸로 출력됨
# 3. get the nth rows only
test_df[::30] # 30번째 행마다 출력됨

# 4. get specific column
test_df['Province_State'] # 특정 칼럼만 출력됨
# 5. get specific columns
test_df[['Date','Country_Region']] # 특정 칼럼들만 출력됨

# 6. get specific row & column
test_df[3:6][['Date','Country_Region']] # 3 ~ 5 행의 Date, Country_Region 칼럼만 출력됨

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s