Code Sample, a copy-pastable example if possible

python 3.5 pandas 0.17

for g, grp in p.groupby(level='stock'): grp.to_csv('quotes/{0}.csv'.format(g))

Expected Output

save all the quotes in csv

output of pd.show_versions()

Traceback (most recent call last):

File "", line 79, in grp.to_csv('quotes/{0}.csv'.format(g))

File "C:\Users\LastAncientOne\Anaconda3\lib\site-packages\pandas\core\frame.py", line 1332, in to_csv formatter.save()

File "C:\Users\LastAncientOne\Anaconda3\lib\site-packages\pandas\core\format.py", line 1481, in save compression=self.compression)

File "C:\Users\LastAncientOne\Anaconda3\lib\site-packages\pandas\io\common.py", line 354, in _get_handle f = open(path, mode, errors='replace')

FileNotFoundError: [Errno 2] No such file or directory: 'quotes/AMZN.csv'

Comment From: rockg

You need a fully-specified path, e.g., /home/quotes/AMZN.csv. And I believe that the folder will need to exist before trying to save things there.

Comment From: LastAncientOne

Thank you I got it.