Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CSV] creare automaticamente file .csvt a partire dal .csv #137

Open
pigreco opened this issue Mar 31, 2020 · 1 comment
Open

[CSV] creare automaticamente file .csvt a partire dal .csv #137

pigreco opened this issue Mar 31, 2020 · 1 comment

Comments

@pigreco
Copy link
Contributor

pigreco commented Mar 31, 2020

Esempio:

file CSV

tre campi: Integer, String, Real

pro_com comune incidenza
86001 Agira 2.83
86002 Aidone 0.00
86003 Assoro 2.98
86004 Barrafranca 0.23
86005 Calascibetta 0.46
86006 Catenanuova 0.00
86007 Centuripe 0.00
86008 Cerami 1.54
86009 Enna 0.41

relativo file csvt

Un file .csvt contiene solo una riga e i tipi per ogni colonna devono essere quotati e separati da virgola , ad es

"Integer", "String", "Real"

oppure:

"Integer (6)", "Stringa (22)","Real (2,2)"

Fonte:


Allego i due file di esempio:

test.zip

@aborruso
Copy link
Member

aborruso commented Apr 3, 2020

caro @pigreco c'è da predisporre uno script di inferencing.

Un punto di partenza, basato ad esempio su Miller, applicato al tuo file

mlr --c2x put 'for (k,v in $*) { $[k."_type"] = typeof(v) }' then cut -r -f "_type" then head -n 1 test.csv

che restituisce

pro_com_type   int
comune_type    string
incidenza_type float

Work in progress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants