python pandas 环境 迭代生成dataframe 出错,求大神指导
import numpy as np
import pandas as pd
from pandas import Series,DataFrame
import tushare as ts
hy=ts.get_industry_classified()
hy=hy[hy['c_name']=='环保行业']
cfgp=np.array(hy.code)
cfgp=cfgp.tolist()
cfgp=list(cfgp)
heji=pd.DataFrame()
for xx in cfgp:
gp=ts.get_hist_data(xx)
gp['code']=xx
heji=heji.append(gp)
print(heji.shape)
-------------------------------------
Traceback (most recent call last):
File "d:\jiangwei\Documents\python_code\test2.py", line 22, in <module>
gp['code']=xx
TypeError: 'NoneType' object does not support item assignment
一直报错,弄了好久都解决不了,求大神指导,带我出坑。