Skip to content Skip to sidebar Skip to footer

Python 3 - Zip Is An Iterator In A Pandas Dataframe

I am following the Pandas tutorials The tutorials are written using python 2.7 and I am doing them in python 3.4 Here is my version details. In [11]: print('Python version ' + sys.

Solution 1:

You need to change this line:

BabyDataSet = zip(names,births)

to:

BabyDataSet = list(zip(names,births))

This is because zip now returns an iterator in python 3, hence your error message. For more details see: http://www.diveintopython3.net/porting-code-to-python-3-with-2to3.html#zip and https://docs.python.org/3/library/functions.html#zip

Post a Comment for "Python 3 - Zip Is An Iterator In A Pandas Dataframe"