0

a less experienced programmer here trying to make some headway on a python project I have started. I have a background in finance but am trying to tie python in to expand myself professionally. But I am trying to access the Bureau of Labor Statistics Json API and have been successful using their sample script I will provide below.

My question is how to get the data exported to a CSV format instead of the Pretty Tables Text file. Any help/resources you can provide would be greatly appreciated.

Sample Script Pretty Table output that I would like to have in CSV

I have had success getting data for various series ID's (CPI, and other economic measures), just not able to get it to CSV/XLSX. This format would make the data much easier for me to work with as I'm more familiar with those files.

  • Well, you can do `line.strip(' |'.split(' | ')` to convert those lines to a list of fields, and from there it's easy to write a CSV. – Tim Roberts Dec 26 '22 at 21:27

0 Answers0