Pandas 将一个列表索引附加到另一个不同长度的列表索引
获取此错误:上传中的第341行 lst3=lst1.extendlst2 AttributeError:“索引”对象没有属性“扩展” 使用值将索引/系列转换为列表,如下所示Pandas 将一个列表索引附加到另一个不同长度的列表索引,pandas,dataframe,python-3.7,Pandas,Dataframe,Python 3.7,获取此错误:上传中的第341行 lst3=lst1.extendlst2 AttributeError:“索引”对象没有属性“扩展” 使用值将索引/系列转换为列表,如下所示 lst2 = pd.Index(lst2).values 使用值将索引/系列转换为列表,如下所示 lst2 = pd.Index(lst2).values 同样的错误更新了现在添加的答案,同样的错误更新了现在添加的答案,同样的错误更新了现在添加的答案,同样的错误更新了现在添加的答案,拥有了一个lookuse lst1=d
lst2 = pd.Index(lst2).values
使用值将索引/系列转换为列表,如下所示
lst2 = pd.Index(lst2).values
同样的错误更新了现在添加的答案,同样的错误更新了现在添加的答案,同样的错误更新了现在添加的答案,同样的错误更新了现在添加的答案,拥有了一个lookuse lst1=df.columns[:18]。tolist和lst2=pd.Indexlst2.tolist解决了我的问题这解决了我的问题
lst2 = pd.Index(lst2).values
# Partial list of headers
lst1 = df_.columns[:18].values
# converting first row to list
lst2 = df_.iloc[1, 18:].to_numpy()
lst2 = pd.Index(lst2).values
import numpy
lst3 = numpy.concatenate((lst1, lst2))
print(lst3)
df_.columns = lst3
df_ = df_[2:]