On 22/08/2018 07:46, Rafael Knuth wrote:
import pandas as pd
cities_lst = pd.read_table("cool_cities.csv")
cities_lst.head()

I was trying to rewrite the above as a function.
Unlike my code above, my function below did not return the first 5
rows, but just nothing:

def cities(file_name):
     import pandas as pd
     cities_lst = pd.read_table(file_name)
     cities_lst.head()
try "return cities_lst.head()" rather than just "cities_list.head()"

cities("cool_cities.csv")

Why does my function not return the first 5 rows?
What's the mistake I am making here?
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to