我有以下代码。当我保存它。列标题不保存。你可以指导我吗?
import numpy as np
import pandas as pd
A = np.random.randint(0, 10, size=36).reshape(6, 6)
df = pd.DataFrame(A, columns=['one', 'two', 'three','four','five','six'])
np.savetxt("/home/dataset/test.csv",df, delimiter=",")
答案 0 :(得分:0)
使用内置pandas
功能:
df.to_csv("your_file_path_here")