public class CSV
extends java.lang.Object
| Constructor and Description |
|---|
CSV()
Constructor.
|
CSV(org.apache.commons.csv.CSVFormat format)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
CSV |
charset(java.nio.charset.Charset charset)
Sets the charset.
|
smile.data.type.StructType |
inferSchema(java.io.Reader reader,
int limit)
Infer the schema from the top n rows.
|
smile.data.DataFrame |
read(java.nio.file.Path path)
Reads a CSV file.
|
smile.data.DataFrame |
read(java.nio.file.Path path,
int limit)
Reads a limited number of records from a CSV file.
|
smile.data.DataFrame |
read(java.lang.String path)
Reads a CSV file.
|
smile.data.DataFrame |
read(java.lang.String path,
int limit)
Reads a limited number of records from a CSV file.
|
CSV |
schema(smile.data.type.StructType schema)
Sets the schema.
|
void |
write(smile.data.DataFrame df,
java.nio.file.Path path)
Writes a data frame to a file with UTF-8.
|
public CSV()
public CSV(org.apache.commons.csv.CSVFormat format)
format - The format of a CSV file.public CSV schema(smile.data.type.StructType schema)
schema - the schema of file.public CSV charset(java.nio.charset.Charset charset)
charset - the charset of file.public smile.data.DataFrame read(java.lang.String path)
throws java.io.IOException,
java.net.URISyntaxException
path - a CSV file path or URI.java.io.IOExceptionjava.net.URISyntaxExceptionpublic smile.data.DataFrame read(java.lang.String path,
int limit)
throws java.io.IOException,
java.net.URISyntaxException
path - a CSV file path or URI.limit - reads a limited number of records.java.io.IOExceptionjava.net.URISyntaxExceptionpublic smile.data.DataFrame read(java.nio.file.Path path)
throws java.io.IOException
path - a CSV file path.java.io.IOExceptionpublic smile.data.DataFrame read(java.nio.file.Path path,
int limit)
throws java.io.IOException
path - a CSV file path.limit - reads a limited number of records.java.io.IOExceptionpublic smile.data.type.StructType inferSchema(java.io.Reader reader,
int limit)
throws java.io.IOException
java.io.IOExceptionpublic void write(smile.data.DataFrame df,
java.nio.file.Path path)
throws java.io.IOException
java.io.IOException