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

error reading space delimited data (FRED) #53

Open
asbisen opened this issue Jul 10, 2019 · 0 comments
Open

error reading space delimited data (FRED) #53

asbisen opened this issue Jul 10, 2019 · 0 comments

Comments

@asbisen
Copy link

asbisen commented Jul 10, 2019

What is the proper way to read space delimited data set. I am unable to read FRED data which has the following structure.

I have tried following constructs

  • readdlm("https://fred.stlouisfed.org/data/PMAIZMTUSDM.txt", skip=17)
    This incorrectly reads the entire row as a single record.
DataFrameRow
│ Row │ DATE                   VALUE │
│     │ String                       │
├─────┼──────────────────────────────┤
│ 1   │ 1980-01-01 105.5068130493160 │
  • readdlm("https://fred.stlouisfed.org/data/PMAIZMTUSDM.txt", skip=17, trim=false, delim=' ')
    This errors out with the following message
TableReader.ReadError: unexpected number of columns at line 19

Stacktrace:
 [1] readdlm_internal(::TranscodingStreams.TranscodingStream{TranscodingStreams.Noop,Base.Process}, ::TableReader.LexerParameters) at /opt/julia/packages/TableReader/XQZpf/src/TableReader.jl:434
 [2] (::getfield(TableReader, Symbol("##6#11")))(::Base.Process) at /opt/julia/packages/TableReader/XQZpf/src/TableReader.jl:269
 [3] open(::getfield(TableReader, Symbol("##6#11")), ::Cmd) at ./process.jl:680
 [4] #readdlm#5(::Char, ::Char, ::Bool, ::Bool, ::Int64, ::Bool, ::String, ::Nothing, ::Bool, ::Bool, ::Int64, ::Nothing, ::typeof(readdlm), ::String) at /opt/julia/packages/TableReader/XQZpf/src/TableReader.jl:268
 [5] (::getfield(TableReader, Symbol("#kw##readdlm")))(::NamedTuple{(:skip, :trim, :delim),Tuple{Int64,Bool,Char}}, ::typeof(readdlm), ::String) at ./none:0
 [6] top-level scope at In[41]:1

RAW Data Structure

Title:               Global price of Corn
Series ID:           PMAIZMTUSDM
Source:              International Monetary Fund
Release:             Primary Commodity Prices (Not a Press Release)
Seasonal Adjustment: Not Seasonally Adjusted
Frequency:           Monthly
Units:               U.S. Dollars per Metric Ton
Date Range:          1980-01-01 to 2019-04-01
Last Updated:        2019-06-20 9:58 AM CDT
Notes:               Value represents the benchmark prices which are representative of the
                     global market. They are determined by the largest exporter of a given
                     commodity. Prices are period averages in nominal U.S. dollars.
                     
                     Copyright © 2016, International Monetary Fund. Reprinted with
                     permission. Complete terms of use and contact details are available at
                     http://www.imf.org/external/terms.htm.
    
DATE                   VALUE
1980-01-01 105.5068130493160
1980-02-01 114.1678314208980
1980-03-01 109.8373184204100
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

1 participant