8000 Displaying `DateTime` columns · Issue #2861 · JuliaData/DataFrames.jl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Displaying DateTime columns #2861
@martincornejo

Description

@martincornejo

The following exemplifies a DataFrame with datetime data:

datetime_table.csv

Time, Value
2014-01-01T00:00:00.0,0.485207
2014-01-01T00:00:01.0,0.485207
2014-01-01T00:00:02.0,0.485207
2014-01-01T00:00:03.0,0.485207
2014-01-01T00:00:04.0,0.485207
2014-01-01T00:00:05.0,0.485207
2014-01-01T00:00:06.0,0.485207
2014-01-01T00:00:07.0,0.485207
2014-01-01T00:00:08.0,0.485207
2014-01-01T00:00:09.0,0.485207
2014-01-01T00:00:10.0,0.485207
2014-01-01T00:00:11.0,0.485207
2014-01-01T00:00:12.0,0.485207
2014-01-01T00:00:13.0,0.485207
2014-01-01T00:00:14.0,0.485207
using Dates
using DataFrames, CSV

df = CSV.File("datetime_table.csv") |> DataFrame

The DateTime entries are displayed in a redundant form

julia> df
15×2 typename(DataFrame)
│ Row │ Time                            │  Value   │
│     │ DateTime                        │ Float64  │
├─────┼─────────────────────────────────┼──────────┤
│ 1   │ DateTime("2014-01-01T00:00:00") │ 0.485207 │
│ 2   │ DateTime("2014-01-01T00:00:01") │ 0.485207 │
│ 3   │ DateTime("2014-01-01T00:00:02") │ 0.485207 │
│ 4   │ DateTime("2014-01-01T00:00:03") │ 0.485207 │
│ 5   │ DateTime("2014-01-01T00:00:04") │ 0.485207 │
│ 6   │ DateTime("2014-01-01T00:00:05") │ 0.485207 │
│ 7   │ DateTime("2014-01-01T00:00:06") │ 0.485207 │
│ 8   │ DateTime("2014-01-01T00:00:07") │ 0.485207 │
│ 9   │ DateTime("2014-01-01T00:00:08") │ 0.485207 │
│ 10  │ DateTime("2014-01-01T00:00:09") │ 0.485207 │
│ 11  │ DateTime("2014-01-01T00:00:10") │ 0.485207 │
│ 12  │ DateTime("2014-01-01T00:00:11") │ 0.485207 │
│ 13  │ DateTime("2014-01-01T00:00:12") │ 0.485207 │
│ 14  │ DateTime("2014-01-01T00:00:13") │ 0.485207 │
│ 15  │ DateTime("2014-01-01T00:00:14") │ 0.485207 │

Instead, the normal show method for DateTime is less verbose, simply showing the timestamp in ISO format.

julia> DateTime("2014-01-01T00:00:00")
2014-01-01T00:00:00

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0