Professional Documents
Culture Documents
E201-Aakah Jathore - Lab - Ass - No - 04
E201-Aakah Jathore - Lab - Ass - No - 04
df = pd.DataFrame(data)
print(df)
print("\n multiple clms")
print(df[['Name','age']])
print("\n filtering rows based age above 20")
print(df[df['age']>20])
df['Gender']=['male','male','male','female','male']
print("\n Adding a new column(Gender):")
print(df)
# Dropping a column
df.drop('city',axis=1, inplace=True)
print("\n Dropping a column (city):")
print(df)
#Sorting by values
#describe
print(df.describe())
multiple clms
Name age
0 rohit 25
1 sanket 35
2 shridhar 26
3 Anushka 37
4 nakul 33
df = pd.read_csv('Documents/nike_shoes_sales.csv')
print(df.describe())
print(df)
# 5.What is the range of listing prices (difference between maximum and minimum)?
listing_price_range = df['listing_price'].max() - df['listing_price'].min()
print("5.Range of listing prices:", listing_price_range)
# 19.How many products have a sale price equal to the listing price?
products_with_equal_listing_and_sale_price = df[df['listing_price'] == df['sale_price']].shape[0]
print("19. Number of products with sale price equal to listing price:", products_with_equal_listing_and_sale_price)
images
0 ["https://static.nike.com/a/images/t_PDP_1728_...
1 ["https://static.nike.com/a/images/t_PDP_1728_...
2 ["https://static.nike.com/a/images/t_PDP_1728_...
3 ["https://static.nike.com/a/images/t_PDP_1728_...
4 ["https://static.nike.com/a/images/t_PDP_1728_...
.. ...
638 ["https://static.nike.com/a/images/t_PDP_1728_...
639 NaN
640 NaN
641 ["https://static.nike.com/a/images/t_PDP_1728_...
642 ["https://static.nike.com/a/images/t_PDP_1728_...
In [ ]: