Replies: 6 comments 6 replies
-
i mean is there any option with reading csv files into dataframe with default index? |
Beta Was this translation helpful? Give feedback.
-
Data columns in a DataFrame can be at most as long as the index column. That means if you want to read a csv file without an index, you must load the index into the DataFrame first and then read the csv file. For example, you can use |
Beta Was this translation helpful? Give feedback.
-
C++ is a statically typed language. It means all types must be known at compile time (i.e. when you write the code). |
Beta Was this translation helpful? Give feedback.
-
In general it doesn't make sense to read pointers to objects from a file. Pointers are assigned at runtime by the OS |
Beta Was this translation helpful? Give feedback.
-
yeah, you can play around with it that way |
Beta Was this translation helpful? Give feedback.
-
just for information of others, we can use torch::from_blob on each column to read data column wise, and then use torch::cat to concatenate all tensors. This serves two purposes, first obviously it reads all data into torch tensor. secondly, from_blob does not allocate any new memory, and is only reading directly from passed column, so if any thing changes, it becomes invalid. torch::cat makes new memory, so now we have a completely new tensor. If someone thinks of a better way, do let me know please. |
Beta Was this translation helpful? Give feedback.
-
Hi
I am writing for a project in which i am trying to mimic pandas and pytorch in cpp. First step is reading csv files, and i have found way to manipulate header so that it is in the format required by dataframe.read method. However, these csv files have no index column, so can someone guide what to do in that case? i have turned columns_only flag to true, but that gives error "Data size is larger than index size of 0". Any suggestions?
Beta Was this translation helpful? Give feedback.
All reactions