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.read cannot detect "Time" type string #526

Closed
evveric opened this issue Nov 8, 2019 · 1 comment
Closed

CSV.read cannot detect "Time" type string #526

evveric opened this issue Nov 8, 2019 · 1 comment

Comments

@evveric
Copy link

evveric commented Nov 8, 2019

I have a DataFrame with a "Time" column

I CSV.write this DataFrame to a File, then CSV.read it back

DataFrame does not recognize it is a TIme, it reads as a "String"

How to fix it? Thank you

df = DataFrame(thistime=[Time(10,0,0), Time(12,0,0)])

CSV.write(raw"c:\temp\testtime.csv", df)

df2 = CSV.read(raw"c:\temp\testtime.csv") |> DataFrame

println(eltypes(df2))

DataType[String]

@quinnj
Copy link
Member

quinnj commented Nov 8, 2019

You can provide the type manually, like:

julia> df2 = CSV.read("testtime.csv", types=[Time])
2×1 DataFrame
│ Row │ thistime │
│     │ Time     │
├─────┼──────────┤
│ 110:00:00 │
│ 212:00:00

But it does look like our auto-detection code isn't picking up the Time type here for you. Thanks for the report!

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