Snippets tagged csv

  • CSV reader

    I've modified the CSV sample from Expert F# to my needs. I don't wann be forced to use the csv schema as defined by column rows. Therefore I've done two major modifications. 1. remove the permutation 2. added a new column name option to the ColumnAttribute 3. added a name to csv index mapping So basically you now have 3 options. 1. Don't annotate your record at all and use it as POCO. The order of the record fields is mapped directly to the order in the csv. UPDATE: I don't recommend this any more. As of the writing of this snippet I wasn't aware of the fact, that field order isn't guaranted by the reflection mechanism. 2. Use the index option of the ColumnAttribute. Same as before. 3. Use the name option. This is what I've looked for. I've to deal with tons of csv that has more columns I'm interested in. Have a look at the sample usage below. I've moved the type conversion out of the CsvReader class in order to be easyly expandable with custom type conversation (i.e. for combined column values - denormalized data)

    4 people like this

    Posted: 6 years ago by Rainer Schuster

  • String.split

    String split function that skips quoted strings, useful as a simple CSV parser

    5 people like this

    Posted: 4 years ago by Phillip Trelford

  • Course 4: Decision trees and Titanic

    F# introduction course - Get and read the Titanic data set using CSV type provider, define the type of "feature" and use it to classify the data and then implement a simple decision tree that can be used for writing more complex classifiers. To be used in Try F#.

    6 people like this

    Posted: 4 years ago by Tomas Petricek

  • CSV writer

    A simple CSV writer implementation as two type extensions for the Seq module. Use it with Records, Classes and Tuples. Have a look at the modified CSV reader sample from Don Symes Expert F# too in order to advance this snippet using the ColumnAttribute This version adds quote enclosure support and support for seq datatype.

    2 people like this

    Posted: 1 months ago by Rainer Schuster