Message from Python discussions

November 2018

— Well, in the csv file I am working with , dates are strings , like '01.01.2018'. So I want to reformat them into datetime format. I looked this up in the documentation. Dataframe.astype() allow to change the dtypes of dataframe. SO I can't really understand. Should I reformat all the string-dates in the dataframe into datetime types before I write 'df.astype(datetime)' or should I preliminarily apply this function and do all the reformating afterwards

Message permanent page

— 

Sorry but i don't know which library do you use. Dtype, Dataframe etc. I can't help with that. But if the thing is convert them to datetime object, why not just use builtin datetime library?
And you said that there are exact number of spaces on each cell. If you use datetime library you don't need to strip them at all.


datetime.datetime.strptime

would do the trick.

— I have done that

— DataFrame is a object of Pandas library

— Thanks. But for some reason I thought it wouldn't work without deleting whitespaces beforehand

— Idk about the edges but to make it look better add some white blurred pieces to make it look like it's reflecting light

Message permanent page

— Https://www.tutorialspoint.com/How-to-convert-Python-date-string-mm-dd-yyyy-to-datetime

— I'll also need to figure that too

— You can create a function like that and then use apply() method over the column of df

— 375093xxxxx100x / 375092xxxxx100x

— What if he wants to run until 3544

— Assign n=3544