Comments (4)
I've just tested with the version on master (not the one from NuGet which is older), and if you specify the "en-us" culture, Dato is recognized as string and Usd is recognized as decimal. The reason for that is that "31.01.2013" is not a valid date under en-us (it would be day 1 of month 31), so it fallbacks to string instead of DateTime. On the other hand, if you specify "nb-no" culture, both Dato and Usd are recognized as dates. The problem is that the decimal-separator is "," and not "." under nb-no, so it's not recognized as a double or decimal, but if you try and DateTime.Parse 5.4833, under both cultures it success to recognize it as May 1st 4833!! :( As a workaround, if you use the "en-gb" culture, it will recognize Dato as a valid datetime and USD as a decimal.
PS: you can pass the url directly to the type provider and create an instance without having to download the file explicitely
let exchange = new FSharp.Data.CsvProvider<"https://www.dnb.no/portalfront/datafiles/miscellaneous/csv/historiske_kurser.csv", ",", "nb-no", 10>()
from fsharp.data.
The root of the problem here is that this csv has dates in a culture, and the rates in another, but that might as well be very common
One possible solution would be for the AsDecimal and AsFloat conversion functions to always accept invariant culture in addition to the culture specified, but that could be dangerous, because "," in the invariant culture (which in fact is en-us) is a thousands separator, and that might make 1,234 to be recognized as 1234. Maybe a better option would be just to not ever allow to convert that to a datetime under any culture, and leave it as a string, probably it would be better.
If we implement #19 this is partially solved, or maybe we could allow culture override per column by adding " (nb-no)" to the header, in a similar way we do it for measures
from fsharp.data.
Thanks for responding to this issue so quickly. And you are of course right, DNB is mixing different formats (Norwegian date and US decimal separator), so understandably the detection is incorrect. Good tip on using the en-us format.
As for passing in the URL, that do not work with the version up on NuGet, but as you said you tested using the version in Master, so might just be new stuff coming in next release.
from fsharp.data.
Thanks for reporting this bug (or oddity) and thanks to @ovatsus for fixing it! It is now in the master and it will be in the next release. I also included this as a test (tpetricek@1c40e94)
from fsharp.data.
Related Issues (20)
- The design-time type 'FSharp.Data.Runtime.StructuralInference+InferenceMode' utilized by a type provider was not found HOT 8
- Support DateOnly and TimeOnly types HOT 2
- FSharp.Data.Core.Tests.CSharp.csproj: [NU1504] Duplicate 'PackageReference' items found. HOT 2
- s HOT 1
- JsonProvider - writable properties? HOT 1
- When closing VS 2022, the FSharp.Data.DesignTime stays on lock that prevents closing the editor. HOT 1
- Why are the core features (`CommonRuntime` folder) implemented in the Http project? HOT 6
- Question: an F# type provider backed by ML.NET for AI/learning HOT 1
- A way forward with the JsonProvider HOT 17
- Requesting a new beta package published to nuget.org HOT 3
- FSharp.Data.Runtime.Utilities is not published HOT 2
- Preserving linefeed style HOT 3
- A new FSharp.Data.JsonSaveOptions value needed HOT 3
- XmlProvider generates types based on name attribute in XSD schema rather than the type attribute HOT 5
- support empty space separator HOT 1
- update pictures in docs with #r nuget reference (no .dll ref)
- Update FSharp.Core from 5 to 6 or 7, to get less memory usage and better performance HOT 4
- System.Text.Json for JsonProvider? HOT 1
- Memory Limitations in XmlProvider HOT 10
- FS3033: Multiple definition of element error.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsharp.data.