简体   繁体   中英

How to_csv in Bluemix

We have a dataframe we are working it in a ipython notebook. Granted, if one could save a dataframe in such a way that the whole group could have access to it through their notebooks, would be ideal, and I'd love to know how to do that. However could you help with the following specific problem?

When we do df.to_csv("Csv file name") it appears that it is located in the exact same place as the files we placed in object storage to utilize in the ipython notebook. However, when one goes to Manage Files, it's nowhere to be found.

When one runs pd.DataFrame.to_csv(df) , text of the csv file is apparently given. However when one copies that into a text editor (ex- Sublime text), saves it at a csv, and attempts to read it in to a dataframe, the expected dataframe is not yielded.

How does one export a dataframe to csv format, and then access it?

I'm not familiar with bluemix, but it sounds like you're trying to save a pandas dataframe in a way that all of your collaborators can access and it look the same way for everyone.

Maybe saving and reading from CSVs is messing up the formatting of your dataframe. Have you tried using pickling ? Since pickling is based around python, it should give consistent results.

Try this:

import pandas as pd
pd.to_pickle(df, "/path/to/pickle/My_pickle")

and on the read side:

df_read = pd.read_pickle("/path/to/pickle/My_pickle")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM