CSV header management

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

CSV header management

Flavio Pompermaier
Hi guys,
how can I read a csv but keeping the header in  some variable without throwing it away?

Thanks in advance,
Flavio
Reply | Threaded
Open this post in threaded view
|

Re: CSV header management

Stephan Ewen
I don't think there is any built-in functionality for that.

You can probably read the header with some custom code (in the driver program) and use the CSV reader (skipping the header) as a regular data source.

On Fri, Apr 17, 2015 at 5:03 PM, Flavio Pompermaier <[hidden email]> wrote:
Hi guys,
how can I read a csv but keeping the header in  some variable without throwing it away?

Thanks in advance,
Flavio

Reply | Threaded
Open this post in threaded view
|

Re: CSV header management

Flavio Pompermaier

My csv has 32 columns,ia there a way to create a Dataset<String[32]>?

On Apr 17, 2015 7:53 PM, "Stephan Ewen" <[hidden email]> wrote:
I don't think there is any built-in functionality for that.

You can probably read the header with some custom code (in the driver program) and use the CSV reader (skipping the header) as a regular data source.

On Fri, Apr 17, 2015 at 5:03 PM, Flavio Pompermaier <[hidden email]> wrote:
Hi guys,
how can I read a csv but keeping the header in  some variable without throwing it away?

Thanks in advance,
Flavio

Reply | Threaded
Open this post in threaded view
|

Re: CSV header management

rmetzger0
Yes, using a map() function that is transforming the input lines into the String array.

On Fri, Apr 17, 2015 at 9:03 PM, Flavio Pompermaier <[hidden email]> wrote:

My csv has 32 columns,ia there a way to create a Dataset<String[32]>?

On Apr 17, 2015 7:53 PM, "Stephan Ewen" <[hidden email]> wrote:
I don't think there is any built-in functionality for that.

You can probably read the header with some custom code (in the driver program) and use the CSV reader (skipping the header) as a regular data source.

On Fri, Apr 17, 2015 at 5:03 PM, Flavio Pompermaier <[hidden email]> wrote:
Hi guys,
how can I read a csv but keeping the header in  some variable without throwing it away?

Thanks in advance,
Flavio