fsprojects / FSharp.Data

F# Data: Library for Data Access
https://fsprojects.github.io/FSharp.Data
Other
806 stars 288 forks source link

support empty space separator #1489

Open jkone27 opened 9 months ago

jkone27 commented 9 months ago

some files like this one cannot be parsed by csv provider, as it uses empty space

https://www.ncei.noaa.gov/data/noaa-global-surface-temperature/v5/access/timeseries/aravg.ann.land_ocean.00N.30N.v5.0.0.202212.asc

ok was able to compile like this

type NoaDataProvider = CsvProvider<
    "https://www.ncei.noaa.gov/data/noaa-global-surface-temperature/v5/access/timeseries/aravg.ann.ocean.00N.30N.v5.0.0.202212.asc",
    "   ", IgnoreErrors=true>

but when i run in ionide i get

/Users/admin/Repositories/scripts/plotlyTest.fsx(8,46): error FS1156: This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int/int32), 1u (uint/uint32), 1L (int64), 1UL (uint64), 1s (int16), 1us (uint16), 1y (int8/sbyte), 1uy (uint8/byte), 1.0 (float/double), 1.0f (float32/single), 1.0m (decimal), 1I (bigint).
nhirschey commented 7 months ago

This is a fixed-width format file. It's not using separators. That's why the first "separator" is sometimes 3 spaces and sometimes 4 spaces. You'd need a fwf provider.