Debug 路漫漫-12:Python: ValueError: 'userid' is both an index level and a column label, which is ambigu

啊,又遇到難題了 ==spa

 想要對兩個 dataframe 作天然鏈接 merge,鏈接的key 爲 「userid」,可是報錯:ValueError: 'userid' is both an index level and a column label, which is ambiguous.blog

 

 

【解決過程】pandas

一、不知道是否是由於pandas版本問題,至少一樣的代碼在去年是能夠跑得通的,今年卻出現了這樣的問題。方法

因而嘗試使用Pycharm選擇暗轉pandas 0.9版本的,(當前Pycharm裏面是0.25版本的),可是安裝失敗……im

嘗試用控制檯,亦失敗……img

二、既然使用 merge 天然鏈接不了,那就使用暴力方法咯:co

搞出一列出來,而後拼接到df2上去。data

相關文章
相關標籤/搜索