python中panda的dateframe

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 });

(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);
原文地址:https://www.cnblogs.com/lanjianhappy/p/7359623.html