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

fixes missing values in fred() being string #84

Merged
merged 2 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/downloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function fred(data::AbstractString="CPIAUCNS")
url = "http://research.stlouisfed.org/fred2/series/$data/downloaddata/$data.csv"
res = HTTP.get(url)
@assert res.status == 200
csv = CSV.File(res.body)
csv = CSV.File(res.body, missingstring = ".")
sch = TimeSeries.Tables.schema(csv)
TimeArray(csv, timestamp = first(sch.names)) |> cleanup_colname!
end
Expand Down Expand Up @@ -175,7 +175,7 @@ function ons(timeseries::AbstractString = "L522", dataset::AbstractString = "MM2
data = json["months"]
dates = [Date(x["year"]*" "*x["month"], dateformat"Y U") for x in data]
values = [parse(Float64, x["value"]) for x in data]
ta = TimeArray((timestamp = dates, monthly = values),timestamp=:timestamp)
ta = TimeArray((timestamp = dates, monthly = values), timestamp = :timestamp)
end
if "quarters" in keys(json)
data = json["quarters"]
Expand Down
1 change: 1 addition & 0 deletions test/downloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ using Test
@test ta |> timestamp |> length > 100
ta = fred("DGS10")
@test ta |> timestamp |> length > 100
@test !(ta isa TimeArray{T} where T<:AbstractString)
end

@testset "Yahoo" begin
Expand Down