I'm trying to export a pandas dataframe to a csv file in a bucket on my google cloud storage, but the following code obviously isn't working for me:
my_df.to_csv(StringIO(file_io.FileIO('gs://mybucket/data/file.csv', mode='w+')))
How should this be rewritten? I'm getting the following error:
unbound method write() must be called within FileIO instance as first argument (got nothing instead)
Apologies if the answer is obvious, but I'm just starting to learn python.