A
A
Alexey Mingaleev2019-07-24 13:54:09
Python
Alexey Mingaleev, 2019-07-24 13:54:09

How to save 4 different csv files in Python?

There is a code:

for name, data in dat.groupby('mode'): 
dat.to_csv("name" + ".csv") 
print(name, data)

How from this to save separate csv files that are contained in name?
Thanks for the answer

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Larisa .•º, 2019-07-24
@barolina

for i , name in enumerate(data):
   print("".join([name, str(i), '.csv'])

https://www.geeksforgeeks.org/enumerate-in-python/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question