-
Notifications
You must be signed in to change notification settings - Fork 853
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
chore: add csv example #4904
chore: add csv example #4904
Conversation
Signed-off-by: fan <[email protected]>
|
||
fn main() { | ||
// read csv from file | ||
let file = File::open("arrow-csv/test/data/example.csv").unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I think don't need create a new file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor nits
arrow-csv/examples/README.md
Outdated
--> | ||
|
||
# Examples | ||
- [`csv_calculation.rs`](csv_calculation.rs): simple use the csv API to calcuate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [`csv_calculation.rs`](csv_calculation.rs): simple use the csv API to calcuate. | |
- [`csv_calculation.rs`](csv_calculation.rs): performs a simple calculation using the CSV reader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Good iead. 😄
println!( | ||
"max value column(0): {:?}", | ||
s.column(0) | ||
.as_any() | ||
.downcast_ref::<Int16Array>() | ||
.unwrap() | ||
.iter() | ||
.max() | ||
.unwrap() | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println!( | |
"max value column(0): {:?}", | |
s.column(0) | |
.as_any() | |
.downcast_ref::<Int16Array>() | |
.unwrap() | |
.iter() | |
.max() | |
.unwrap() | |
); | |
let col = s.column(0).as_primitive::<Int16Type>(); | |
let max = col.iter().max().flatten(); | |
println!("max value column(0): {max:?}"); |
With the necessary additional imports
Signed-off-by: fan <[email protected]>
Which issue does this PR close?
Part of #1613
Rationale for this change
What changes are included in this PR?
add a example for arrow-csv.
Are there any user-facing changes?