-
-
Save codecademydev/2a936912e69e243238b177108eada358 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import codecademylib | |
import pandas as pd | |
inventory = pd.read_csv('inventory.csv') | |
inventory.head(10) | |
staten_island = inventory[0:10] | |
print(staten_island) | |
product_request = staten_island.product_description | |
print(product_request) | |
seed_request = inventory[(inventory.location == 'Brooklyn') & (inventory.product_type == 'seeds')] | |
print(seed_request) | |
inventory['in_stock'] = inventory.apply(lambda x: True if x['quantity'] > 0 else False, axis = 1) | |
print(inventory.head()) | |
inventory['total_value'] = inventory.apply(lambda x: x.price * x.quantity, axis = 1) | |
print(inventory.head()) | |
combine_lambda = lambda row: \ | |
'{} - {}'.format(row.product_type, | |
row.product_description) | |
inventory['full_discription'] = inventory.apply(lambda x: (x.product_type, x.product_description), axis = 1) | |
print(inventory.head()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment