jmbejara / comp-econ-sp19

Main Course Repository for Computational Methods in Economics (Econ 21410, Spring 2019)
49 stars 27 forks source link

Hw 2 Chipotle #15 #14

Closed erineidschun closed 5 years ago

erineidschun commented 5 years ago

Is there a reason that chipo ['item_price'].sum() returns the full list of item prices instead of summing them? Instead, I have used sum(map(float,chipo['item_price'])), which causes problems since now chipo['item_price'] is of type map.

Previously, this worked: chipo['quantity'].sum()

I think the issue is here (code for #12) . This code worked but I think it may have changed the type for item_price.

chipo['item_price'] = chipo['item_price'].apply(lambda x: x.replace('$','')) #deleting the $ sign chipo.item_price.apply(lambda x: float(x)) #turning into float

Due to this, I am unable to solve #16 since I have an int and a map.

Thanks!

erineidschun commented 5 years ago

Resolved this - was a syntax error!

jmbejara commented 5 years ago

Got it. Sounds good!