The data in df["click"] is in the form of a string yyyyymmddHHMMSS as shown below.
The code below is being used to convert to datetime values.
But the number of rows in DataFrame exceeded 1 million lines, so it was too slow. Is it possible to convert the string data to datetime (yyyy-mm-dd HH:MM:SS) using numpy?
Or even if it's not numpy, what's faster than the source I'm using? DataFrame is Pandas because PySpark, Koalas, and Dask are not available.python mongodb
pd.to_datetime can receive series as a factor.
If the format of the time string is constant, if you fix the
pd.to_datetime won't worry about what format it is, so it will be faster. If it's the format you asked, it's probably like the code below.
© 2022 pinfo. All rights reserved.