Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
505 B
0
Indexable
Never
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
Leave a Comment