Python 3 - Zip is an iterator in a pandas dataframe

后端 未结 1 368
深忆病人
深忆病人 2021-02-05 06:24

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 [         


        
1条回答
  •  不思量自难忘°
    2021-02-05 07:09

    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

    0 讨论(0)
提交回复
热议问题