zljubi...@gmail.com writes: > I have a dataframe with epoh dates, something like this: > > df = pd.DataFrame( { 'epoch' : [1493928008, 1493928067, 1493928127, > 1493928310, 1493928428, 1493928547]}) > > I want to create a new column with epoch converted to yyyy-mm-dd as string.
"epoch" dates usually mean seconds since 1.1.1970, represented as an integer or float. A single epoch date is usually not represented as a list (as above). For details, read the head of the "time" module documentation. The "time" module contains 2 functions to convert from an "epoch date" to a time tuple: "gmtime" (this gives an UTC or Greenwich Mean time tuple) and "localtime" (this gives a time tuple represented in the local time zone). You can use "time.strftime" to get a string representation (according to a format you specify) from a time tuple. Again, the documentation of the "time" module tells the details. -- https://mail.python.org/mailman/listinfo/python-list