You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/25 18:23:08 UTC

[GitHub] [arrow-datafusion] DataPsycho commented on a diff in pull request #4360: Adding more dataframe example to read csv files

DataPsycho commented on code in PR #4360:
URL: https://github.com/apache/arrow-datafusion/pull/4360#discussion_r1032640050


##########
datafusion-examples/examples/dataframe.rs:
##########
@@ -41,3 +44,37 @@ async fn main() -> Result<()> {
 
     Ok(())
 }
+
+// Example to read data from a csv file with inferred schema
+async fn example_read_csv_file_with_inferred_schema() -> Arc<DataFrame> {
+    let path = "example.csv";
+    // Create the data to put into the csv file with headers
+    let content = "id,time,vote,unixtime,rating\na1,\"10 6, 2013\",3,1381017600,5.0\na2,\"08 9, 2013\",2,1376006400,4.5";
+    // write the data
+    fs::write(path, content).expect("Problem with writing file!");
+    // Create a session context and create a lazy

Review Comment:
   Updated as suggested. and Completed the incomplete instruction



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org