Untitled

 avatar
unknown
plain_text
a year ago
505 B
2
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'].sum()
samsung = df_stock[df_stock['item_lowercase'] == 'samsung galaxy a30 32gb']['count'].sum()

df_stock = df_stock.drop_duplicates(subset='item_lowercase').reset_index(drop=True)

df_stock['count'] = df_stock.loc[0]
df_stock['count'] = df_stock.loc[3]

print(df_stock)# write your code here
Editor is loading...
Leave a Comment