【解决办法】read_csv()第一列作为index
生活随笔
收集整理的這篇文章主要介紹了
【解决办法】read_csv()第一列作为index
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
簡(jiǎn)述
在之前讀取csv文件的時(shí)候,發(fā)現(xiàn)第一列被讀到了dataframe的column中了,而不是讀到了index中,查閱完文檔后得到解決。
解決辦法
- index_col : int or sequence or False, default None
* Column to use as the row labels of the DataFrame. If a sequence is given, a MultiIndex is used. If you have a malformed file with delimiters at the end of each line, you might consider index_col=False to force pandas to not use the first column as the index (row names)
比如說(shuō),下面這個(gè)代碼就可以解決了~
將第一列變?yōu)閕ndex。這樣的讀取進(jìn)來(lái)~
總結(jié)
以上是生活随笔為你收集整理的【解决办法】read_csv()第一列作为index的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: DeprecationWarning:
- 下一篇: pandas.DataFrame.mul