Answers for "syntax for loc in python"

2

pandas loc for list

df.loc[df['channel'].isin(['sale','fullprice'])]
Posted by: Guest on March-05-2020
5

pd.loc

>>> df = pd.DataFrame([[1, 2], [4, 5], [7, 8]],
...      index=['cobra', 'viper', 'sidewinder'],
...      columns=['max_speed', 'shield'])
>>> df
            max_speed  shield
cobra               1       2
viper               4       5
sidewinder          7       8

>>> df.loc[['viper', 'sidewinder']]
            max_speed  shield
viper               4       5
sidewinder          7       8
Posted by: Guest on March-19-2020
-2

syntax for loc in python

12       29.6
38       29.6
76       29.6
93       29.6
172      29.6
         ... 
31097    29.6
36812    29.6
38278    29.6
41460    29.6
45698    29.6
Name: mass, Length: 107, dtype: float64
Posted by: Guest on January-12-2021

Python Answers by Framework

Browse Popular Code Answers by Language