fslaborg / Deedle

Easy to use .NET library for data and time series manipulation and for scientific programming
http://fslab.org/Deedle/
BSD 2-Clause "Simplified" License
933 stars 195 forks source link

ReadCsv docs bug #271

Closed adamklein closed 9 years ago

adamklein commented 9 years ago

inferRows defaults to 100, not 0, so the docs are incorrect

Also, cannot seem to pass inferRows = 0 and inferTypes = true; get an error that doesn't seem to make sense:

stdin(29,29): error FS0035: This construct is deprecated: The unnamed arguments do not form a prefix of the arguments of the method called
tpetricek commented 9 years ago

Here is what I get using the following CSV sample: http://pastebin.com/6veM1796

// This loads the last row as <missing>
Frame.ReadCsv("C:/temp/test.csv")

// This loads all data as 'obj' and casts them on access
// so the values on the last row are loaded correctly
Frame.ReadCsv("C:/temp/test.csv", inferTypes=false)

// This will do type inference over the enitre file (slow)
// but will correctly load data as decimals internally
// (assuming the values fit in decimal)
Frame.ReadCsv("C:/temp/test.csv", inferRows=0)

// This will skip type inference and load two columns
// as "float" values internally - thanks to explicit schema
Frame.ReadCsv("C:/temp/test.csv", schema="float,float")
adamklein commented 9 years ago

Do you also get an error if you do inferRows = 0, inferTypes = true? Is there a reason not to pass that combination?

tpetricek commented 9 years ago

I can write both of the following without error:

Frame.ReadCsv("C:/temp/test.csv", inferTypes=true, inferRows=0)
Frame.ReadCsv<DateTime>("C:/temp/test.csv", "Foo", inferTypes=true, inferRows=0)

They are extensions, so I have to add open Deedle, but that's all. This is in VS 2013 with the latest update (perhaps that matters?)

To be fair - I wouldn't be all that surprised if something could go wrong here. The ReadCsv method has a C#-style extension method and F#-style extension so that we can use F#-style optional arguments and C#-style optional arguments at the same time. This is quite messy :-(, but massive number of overloads looks equally bad.

adamklein commented 9 years ago

Nevermind on the original error, cannot reproduce! Weird.