Categories

Versions

Write CSV (RapidMiner Studio Core)

Synopsis

This operator is used to write CSV files(Comma-Separated Values).

Description

A comma-separated values (CSV) file stores tabular data (numbers and text) in plain-text form. CSV files have all values of an example in one line. Values for different attributes are separated by a constant separator. It may have many rows. Each row uses a constant separator for separating attribute values. The name suggests that the attributes values would be separated by commas, but other separators can also be used. This separator can be specified using the column separator parameter. Missing data values are indicated by empty cells.

Input

  • input (Data Table)

    This input port expects an ExampleSet. It is output of the Retrieve operator in the attached Example Process.

Output

  • through (Data Table)

    The ExampleSet that was provided at the input port is delivered through this output port without any modifications.This is usually used to reuse the same ExampleSet in further operators of the process.

  • file

    The created CSV file is provided as a file object that can be used with other operators with file input ports like 'Write File'.

Parameters

  • csv_filepath of the CSV file is specified here. It can be selected using the choose a file button. Range: filename
  • column_separatorColumn separators for the CSV file can be specified here. Range: string
  • write_attribute_namesThis parameter indicates if the attribute names should be written as the first row of the CSV file. Range: boolean
  • quote_nominal_valuesThis parameter indicates if the nominal values should be quoted with double quotes in the CSV file. Range: boolean
  • format_date_attributesThis parameter indicates if the date attributes should be written as a formatted string or as milliseconds past since January 1, 1970, 00:00:00 GMT. Range: boolean
  • date_formatThis parameter only appears when format_date_attributes is selected AND the operator compatibility level is set above 9.9.002. This allows you to specify the format the date should be written as in the CSV file. Range: string
  • append_to_fileThis parameter indicates if new content should be appended to the file or if the pre-existing file content should be overwritten. Range: boolean
  • encodingThis is an expert parameter. There are different options, users can choose any of them. Range: selection

Tutorial Processes

Writing the Labor-Negotiations data set into a CSV file

The 'Labor-Negotiations' data set is loaded using the Retrieve operator. The Write CSV operator is applied on it to write the 'Labor-Negotiations' data set in a CSV file. The csv file parameter is provided with this path: '%{tempdir}/Labor data set.csv'. Thus a CSV file named 'Labor data set' is created in temp folder of your computer. All parameters are used with default values. The write attribute names parameter is set to true thus the first line of the resultant CSV file has the names of the attributes of the 'Labor-Negotiations' data set. The quote nominal values parameter is also set to true, thus all nominal values are quoted with double quotes in the CSV file. Files written by the Write CSV operator can be loaded in RapidMiner using the Read CSV operator.