-
Notifications
You must be signed in to change notification settings - Fork 875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove scientific notation when converting floats to strings. #983
Comments
Instead of calling match c.1 {
Field::Float(f) => format!("{}", f), // or however else you wanted to format floats
Feld::Double(f) => format!("{}", f), // or however else you wanted to format floats
_ => c.1.to_string()
} |
Thanks. I will give this a try. |
I am getting an error with the code below fn pull_rows(row: &parquet::record::Row) -> Vec<std::string::String> {
row.get_column_iter()
.map(|c: (&String, &Field)| match c.1 {
Field::Float(f) => format!("{}", f),
Field::Double(f) => format!("{}", f),
_ => c.1.to_string(),
})
.collect::<Vec<_>>()
} here is the error
Since |
@alexhallam I think the issue is that you are using the "wrong" |
That fixed the issue. Thanks |
Glad you figured out the problem. |
Which part is this question about
parquet
Describe your question
I would like to get a string of the values, but not in scientific notation (if 0.01 then return "0.01" not "1E-2").
Additional context
I am trying to read parquets and print the output, but the fact that conversion to string results in a scientific notation is making the task harder for me. I am guessing there is a simple way to make sure I get the full value without conversion to scientific notation, but I have not found a method for that yet.
I have a snippet of code below showing the general idea.
The text was updated successfully, but these errors were encountered: