How to download the report from API as a data frame

193 views
Skip to first unread message

zhaoy...@shopee.com

unread,
Aug 10, 2018, 4:37:21 PM8/10/18
to AdWords API and Google Ads API Forum
Hello, 

I was trying to download report and save it as a data frame, using the report_downloader.DownloadReport. It do help me get the data and I can save it to a csv. However when I try to read the csv it give me the error as follow: 

Traceback (most recent call last):
  File "C:\Users\Desktop\new\download.py", line 40, in <module>
    main(adwords_client)
  File "C:\Users\Desktop\new\download.py", line 28, in main
    df = pd.read_csv('adwtemp.csv', index_col=None, header=1)
  File "C:\Python27\lib\site-packages\pandas\io\parsers.py", line 709, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "C:\Python27\lib\site-packages\pandas\io\parsers.py", line 449, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "C:\Python27\lib\site-packages\pandas\io\parsers.py", line 818, in __init__
    self._make_engine(self.engine)
  File "C:\Python27\lib\site-packages\pandas\io\parsers.py", line 1049, in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
  File "C:\Python27\lib\site-packages\pandas\io\parsers.py", line 1695, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas\_libs\parsers.pyx", line 565, in pandas._libs.parsers.TextReader.__cinit__
pandas.errors.EmptyDataError: No columns to parse from file

Is there any way I can get the data in the format of data frame? Thanks in advance. 

Plus, I tried to use report_downloader.DownloadReportAsStream, but stacked at the same place when I try to convert the instance to a data frame. 

Dannison Yao (AdWords API Team)

unread,
Aug 12, 2018, 11:27:47 PM8/12/18
to AdWords API and Google Ads API Forum
Hi Zhaoyu,

Unfortunately, AdWords API report does not support customized download format. With this said, your concerns seem to be more related to the Python library and your parser code. You may open your concern to the Python support team as they may be more equipped in answering your concerns.

Regards,
Dannison
AdWords API Team
Reply all
Reply to author
Forward
0 new messages