My code different than project walk through

I am a new learner and I was coding the project but when I compared it with the project walk through, some of the lines of codes are different but the end results are same. Am I doing something wrong and Do my codes can be different than the one in project walkthrough as long as it give results.

Below is my code
and some of the lines are different from project walkthrough.

import codecademylib
import csv
import pandas as pd

inventory = pd.read_csv(‘inventory.csv’)

print(inventory.head(10))

staten_island = inventory.iloc[:10]

product_request = inventory.product_description

seed_request = inventory[(inventory.location == ‘Brooklyn’) & (inventory.product_type == ‘seeds’)]

inventory[‘in_stock’] = inventory.quantity.apply( lambda quantity: True if quantity > 0 else False)

inventory[‘total_value’] = inventory.price * inventory.quantity
print(inventory.head(10))

combine_lambda = lambda row:
‘{} - {}’.format(row.product_type,
row.product_description)

inventory[‘full_description’] = inventory.apply(combine_lambda, axis = 1)
print(inventory.head(10))

Hi, welcome to the forums. Do you have a link to the lesson? Is this the Petal Power project on the DS path?

Did you get the correct results or an error?

https://www.codecademy.com/courses/data-processing-pandas/projects/pandas-inventory-proj

I did get correct results but my code is slightly different than the one in project walk through video

1 Like

It’s okay! There is more than one way to accomplish the same task—most times.
:slight_smile: