Slice in DataFrame

PHOTO EMBED

Sun Nov 07 2021 21:16:28 GMT+0000 (Coordinated Universal Time)

Saved by @Bigby_Wolf #data

df2.loc[["one",'three'],['pop','state']]
df2.loc["one":'three'],['pop','state']]
df2.loc[:'three',['pop','state']]
content_copyCOPY

1. If you wanna slice from DataFrame by loc, notice that the first"[]"is the set the x coordinate, the second"[]" is the set of y coordinate, the ","in it is the divide character. 2. When you choose some line from another line, you shold use : 3.When you choose some line from the first line, you nd't use "[]"