Below is the code where I want to filter in the data frame through the country list in a loop. how to pass that value in the Owning country filter?
This is my Code :
countrylist= ['Italy','Germany']
for country in countrylist:
dataframe = dataframe[dataframe['Owning_Country'] == ]
Thanks
Try this out:
countrylist= ['Italy','Germany']
for country in countrylist:
df= df[df['Owning_Country'] == country]
you may have to use sleep from time module i guess.
import time countrylist= ['Italy','Germany'] for country in countrylist: print(country) time.sleep(1) dataframe = dataframe[dataframe['Owning_Country'] == country]
maybe sommeone can provide a better way but as so far this is the simplest way.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.