Deedle - what's the schema format for readCsv

陌路散爱 提交于 2020-01-05 04:39:05

问题


I was using Deedle in F# to read a txt file (no header) to data frame, and cannot find any example about how to specify the schema.

let df= Frame.ReadCsv(datafile, separators="\t", hasHeaders=false, schema=schema)

I tried to give a string with names separated by ',', but seems don't work.

let schema = @"name, age, address";

I did some search on the doc, but only find following - don't know where I can find the info. :(

schema - A string that specifies CSV schema. See the documentation for information about the schema format.


回答1:


The schema format is the same as in the CSV type provider in F# Data.

The only problem (quite important!) is that the Deedle library had a bug where it completely ignores the schema parameter, so no matter what you provide, it would be ignored.

I just submitted a pull request that fixes the bug and also includes some examples (in the form of unit tests). See the pull request here (and click on "Files changed" to see the samples).

If you do not want to wait for a new release, just get the code from my GitHub fork and build it using build.cmd in the root (run this for the first time to restore packages). The complete build requires local installation of R (because it builds R plugin too), but it should build Deedle.dll and then fail... (After the first run of build.cmd, you can just use Deedle.sln solution).



来源:https://stackoverflow.com/questions/20674975/deedle-whats-the-schema-format-for-readcsv

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!