0

Is it possible to write the date modified to a file name with python? I have a large batch of .csv files where the date modified field must be converted to the file name.

Or even better write the date modified to the csv file itself as a column.

F1990
  • 627
  • 2
  • 9
  • 20

1 Answers1

0

use to_datetime() to convert the float value to DatatimeIndex:

from os import path
from glob import glob
pd.to_datetime([path.getmtime(fn) for fn in glob("*.*")], unit="s")
HYRY
  • 94,853
  • 25
  • 187
  • 187