No infer schema (#3683)

* Type in command description

* filter name change

* Clean column name

* Clippy error and updated polars version

* Lint correction in file

* CSV Infer schema optional
This commit is contained in:
Fernando Herrera 2021-06-25 09:35:07 +01:00 committed by GitHub
parent 596062ccab
commit 91da4e3168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,7 +43,7 @@ impl WholeStreamCommand for DataFrame {
.named(
"infer_schema",
SyntaxShape::Number,
"Set number of row to infer the schema of the file. CSV file",
"Set number of rows to infer the schema of the file. CSV file",
None,
)
.named(
@ -172,14 +172,10 @@ fn from_csv(args: CommandArgs) -> Result<polars::prelude::DataFrame, ShellError>
}
};
let csv_reader = if no_header {
csv_reader.has_header(false)
} else {
csv_reader.has_header(true)
};
let csv_reader = csv_reader.has_header(!no_header);
let csv_reader = match infer_schema {
None => csv_reader.infer_schema(None),
None => csv_reader,
Some(r) => csv_reader.infer_schema(Some(r.item)),
};