“df.loc” Kode Jawaban

PANDAS LOC untuk daftar

df.loc[df['channel'].isin(['sale','fullprice'])]
Elegant Earthworm

df.loc

# Getting values on a DataFrame with an index that has interger "labels"
df = pd.DataFrame([[1, 2], [4, 5], [7, 8]],
...      index=[7, 8, 9], columns=['max_speed', 'shield'])
>>> df
   max_speed  shield
7          1       2
8          4       5
9          7       8

# the integer is interpreted as "label" but NOT an "interger position along the index"
>>> df.loc[7:9]
   max_speed  shield
7          1       2
8          4       5
9          7       8
Gifted Guanaco

Jawaban yang mirip dengan “df.loc”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya