如何在 pandas Datframe 中正确存储?
link to dataset:"https://lib.stat.cmu.edu/datasets/boston"
# Importing
data_url = "http://lib.stat.cmu.edu/datasets/boston"
# Define your column names
column_names = ['CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE', 'DIS', 'RAD', 'TAX', 'PTRATIO', 'B', 'LSTAT', 'MEDV']
boston = pd.read_csv(data_url, skiprows=21, sep =r'\s+', names = column_names, header= None, engine='python')
boston.head(2)
您需要 .to_csv 。我看到你使用 pandas 所以通过这样保存你可以轻松地重复使用
car_sales.to_csv("/home/slainst/Documents/Tensorflow_MachineLearning/data/car-sales.csv")