Select to view content in your preferred language

Writing a CSV from Python Notebook

125
3
Jump to solution
Thursday
JerryDavis
Occasional Contributor

In ArcGIS Online, I would like to create a CSV from a data frame in ArcGIS API for Python using .to_csv, however I don't know where to access the result.  For example, the code below should write the file "output.csv" somewhere.  It doesn't create an error, but I cannot see it listed in AGOL.  I've also tried my folder names created in AGOL, but don't see the CSV listed.

import pandas as pd
df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
df.to_csv('output.csv', index=False)

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
BobBooth1
Esri Regular Contributor

In an ArcGIS Notebook, in ArcGIS Online, the file system is accessible from the Files menu.

Files_menu_notebook.png

You can save to the default location, or import the OS module in Python and make new folders, work with paths, like you would locally.

See this for example:

https://www.arcgis.com/home/item.html?id=fe8a61ca94c54e6e8e62c2faed0b68cf#preview

View solution in original post

3 Replies
DanPatterson
MVP Esteemed Contributor

creating and sharing csv's

CSV, TXT, and GPX files—ArcGIS Online Help | Documentation


... sort of retired...
0 Kudos
BobBooth1
Esri Regular Contributor

In an ArcGIS Notebook, in ArcGIS Online, the file system is accessible from the Files menu.

Files_menu_notebook.png

You can save to the default location, or import the OS module in Python and make new folders, work with paths, like you would locally.

See this for example:

https://www.arcgis.com/home/item.html?id=fe8a61ca94c54e6e8e62c2faed0b68cf#preview

JerryDavis
Occasional Contributor

Fabulous, helps immensely.  Don't know why I never noticed that little Files button....

0 Kudos