将数据帧写入csv

时间:2018-05-04 18:22:54

标签: python python-3.x pandas data-analysis

我正在尝试使用!cat将数据帧写入csv文件,但我遇到了一些错误。

代码:

data.to_csv(r'C:\Users\Downloads\pydata\pydata-book-2nd-edition\examples\out.csv')
!cat C:\Users\Pruthvish\Downloads\pydata\pydata-book-2nd-edition\examples\out.csv
,something,a,b,c,d,message
0,one,1,2,3.0,4
1,two,5,6,,8,world
2,three,9,10,11.0,12,foo

错误:

'cat' is not recognized as an internal or external command, operable program or batch file.
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-194-9f4495d324cb> in <module>()
      1 get_ipython().system('cat C:\\Users\\Downloads\\pydata\\pydata-book-2nd-edition\\examples\\out.csv')
----> 2 something(",a,b,c,d,message")
      3 0,one,1,2,3.0,4
      4 1,two,5,6,,8,world
      5 2,three,9,10,11.0,12,foo

NameError: name 'something' is not defined

我甚至尝试了!type!more,但名称错误仍然存​​在。我该如何解决这个错误?

0 个答案:

没有答案