Answers for "df to csv string"

1

df to csv

>>> df = pd.DataFrame({'name': ['Raphael', 'Donatello'],
...                    'mask': ['red', 'purple'],
...                    'weapon': ['sai', 'bo staff']})
>>> df.to_csv(index=False)
Posted by: Guest on February-07-2021
0

get panda df as a string csv

>>> df = pd.DataFrame({'A' : [0, 1], 'B' : [1, 6]})
>>> df.to_csv()
',A,B\n0,0,1\n1,1,6\n'
Posted by: Guest on June-14-2021

Python Answers by Framework

Browse Popular Code Answers by Language