IBM Support

Why Watson Studio Local 1.2.3.1's Refinery fails to load the CSV file exported from Pandas DataFrame ?

Question & Answer


Question

I have following simple Notebook to save Pandas DataFrame to CSV data set in Project's Assets.
image-20200210114940-1
By running above code, I could correctly create a CSV data set on my Project's Assets
image-20200210115303-2
However, when I clicked this data set to preview it in Refinery, it failed and following error occurred:
image-20200210115555-3
Could you tell me how to save Pandas DataFrame to Watson Studio Local 1.2.3.1 Data Set correctly?

Cause

By default the Pandas df.to_csv() function includes the index field while exporting Pandas Data Frame to CSV file. However, since this index fields doesn't have column name, the csv file contains null as the field name of index column. The Watson Studio Local 1.2.3.1 Refinery error occurred because it could not parse the csv with null field name.

Answer

This issue can be solved by dropping the index column when exporting the Pandas DataFrame to CSV file.
image-20200210120903-4
Confirm Data Set created
image-20200210121112-5
Confirmed Refinery can open this Data Set correctly
image-20200210121225-6

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSHGWL","label":"IBM Watson Studio Local"},"Component":"Jupyter Notebook, Refinery","Platform":[{"code":"PF016","label":"Linux"}],"Version":"WSL 1.2.3.1","Edition":"N\/A","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
09 February 2020

UID

ibm11846365