- Published on
- Authors
- Name
- KAUSTUBH SHARMA
PreRequisite
- Read about How to Split Dataset(only 1 min. read).
Convert DataSet to CSV Files
- Convert the train and validation dataframe objects to CSV files to match the input file format for the XGBoost algorithm.
train.to_csv('train.csv', index=False, header=False)
validation.to_csv('validation.csv', index=False, header=False)
where
- 'train.csv'= Name of CSV file that will be created or overwritten. If the file already exists, it will be replaced.
- index=False : Parameter is set to False to exclude the index column from being written to the CSV file. If True (which is the default), the index column would be included in the output.
- header=False: Parameter is set to False to exclude the header (column names) from being written to the CSV file. If True (which is the default), the header would be included in the output.