1 函数介绍

#to_csv函数的语法
#函数原型
# to_csv(filepath,sep=",",index=TRUE,header=TRUE)
#参数介绍:
#(1)导出的文件路径
#(2)分隔符
#(3)是否导出序号 默认为true
#(4)是否导出列名 默认为true

2 案例

(1)创建

1 df = DataFrame({
2     'age': [21, 22, 23], 
3     'name': ['KEN', 'John', 'JIMI']
4 });

python中panda的dateframe

(2)生成csv

1 df.to_csv("H:\\pythonCode\\4.2\\df.csv");

(3)去掉行号

1 df.to_csv("D:\\PA\\4.2\\df.csv", index=False);

 

相关文章:

  • 2022-01-06
  • 2022-12-23
  • 2021-08-17
  • 2021-09-29
  • 2022-03-01
  • 2021-05-22
  • 2021-07-08
  • 2021-12-02
猜你喜欢
  • 2022-03-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
相关资源
相似解决方案