I am new to Python. I got trouble in creating a pandas data frame.
dataDict = {}
dataDict['grant_id'] = grant_ids
dataDict['patent_title'] = patent_title
dataDict['kind'] = kinds
df=pd.DataFrame(dataDict)
The code above works in python2, but when I change to python3, I got error message:
TypeError Traceback (most recent call last)
<ipython-input-6-3a9900bc5bca> in <module>()
9 #dataDict['abstract'] = abstractResult
10
---> 11 df=pd.DataFrame(dataDict)
12
13 df.head()
3 frames
/usr/local/lib/python3.6/dist-packages/pandas/core/internals/construction.py in extract_index(data)
303 elif is_list_like(val) and getattr(val, 'ndim', 1) == 1:
304 have_raw_arrays = True
--> 305 raw_lengths.append(len(val))
306
307 if not indexes and not raw_lengths:
TypeError: object of type 'map' has no len()
grant_ids is a list of integers.
Is there a way to fix it?