“df.loc” Respostas de código

Pandas Loc para lista

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

Respostas semelhantes a “df.loc”

Procure respostas de código populares por idioma

Procurar outros idiomas de código