Reputation: 21
I have a list of Line of Business (for example: Amazon, Ralphs, Target, etc) that I want to run the stats analysis and append final result.
But, my query can do analysis 1 line of business at a time. How can I do run script multiple times based on the list of line of business and append the final result from every combination to a list?
>>> LOB1 = input("Line of Business: ")
>>> spec_sku = spec_sku.loc[spec_sku['LOB'] == LOB1]
>>> spec_sku.head()
Date LOB PG Sales
60639 7 Sep 19 Amazon Snacks 5pk 8370.0
60640 14 Sep 19 Amazon Snacks 5pk 12360.0
60641 21 Sep 19 Amazon Snacks 5pk 8280.0
60642 28 Sep 19 Amazon Snacks 5pk 6450.0
60643 5 Oct 19 Amazon Snacks 5pk 7620.0
Upvotes: 2
Views: 51
Reputation: 1098
You can use the query function to filter on multiple businesses at once.
spec_sku.query("LOB in ['Amazon', 'Ralphs', 'Target']")
Upvotes: 1