Untitled
unknown
plain_text
a year ago
580 B
11
Indexable
import pandas as pd df_stock = pd.read_csv('/datasets/phone_stock.csv') df_stock['item_lowercase'] = df_stock['item'].str.lower() apple = df_stock[df_stock['item_lowercase'] == 'apple iphone xr 64gb'].count()# finish this line of code samsung = df_stock[df_stock['item_lowercase'] == 'samsung galaxy a30 32gb'].count()# finish this line of code #apple = df_stock[df_stock['item'].str.contains('apple')].count() #samsung = df_stock[df_stock['item'].str.contains('samsung')].count() print("Total number of Apple phones:", apple) print("Total number of Samsung phones:", samsung)
Editor is loading...
Leave a Comment