Is there a way to replace this syntax by a list comprehension?
for w in loc:
dict_filter_data[w] = df.loc[df['location'] == w]
If is it possible, would it be faster?
Is there a way to replace this syntax by a list comprehension?
for w in loc:
dict_filter_data[w] = df.loc[df['location'] == w]
If is it possible, would it be faster?
Copyright © 2021 Jogjafile Inc.
You can do:
if
loc
contains all uniquelocation
values then you just need:note that using groupby here is highly recommended, it is much faster than using a for loop. But you could do:
if you want to update
dict_filter_data
(not start empty):Or