-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG-REPORT] vaex (arrow) not accepting '2021-01' as valid string for timestamp #1907
Comments
This may look like a bug, but perhaps it is unsupported feature (by arrow?).
import vaex
import numpy as np
import pyarrow as pa
x = np.array(["2021-09-01"], dtype=np.datetime64)
pa.array(x) # Works as expected i.e. this is Date32Array in arrow
x = np.array(["2021-09"], dtype=np.datetime64)
pa.array(x) # Does not work - no corresponding pyarrow unit So we are facing the same problem (from the other direction): when we have a numpy.datetime64[M] array, there is no corresponding arrow dtype to cast to, hence the error. (from my understanding from looking at the source - i could be wrong) |
This was partially discussed here: #1704 |
Thanks @JovanVeljanoski , yes this is my understanding. import vaex
dates = ["2021-09"]
vdf = vaex.from_arrays(dates=dates)
vdf_01 = vaex.from_arrays(suff=vaex.vconstant("-01", length=len(vdf)))
vdf = vdf.join(vdf_01)
vdf["dates"] = vdf["dates"].str.cat(vdf["suff"]).astype("datetime64") Thanks again, closing the ticket then, |
If you start from an in-memory dataframe, it is better to handle this outside of vaex. |
I think the issue here is that we don't support casting arrow strings to datetime. And we can do this:
Again, with the proper unit tests I'm happy to support this! |
Description
Converting strings like
'2021-01'
(no day) to timestamps thanks toastype('datetime64')
, is not accepted by vaex, timestamps are not recognized, but they are by numpy. Is this to be expected?Software information
Vaex version (
import vaex; vaex.__version__)
:{'vaex': '4.7.0',
'vaex-core': '4.7.0.post1',
'vaex-viz': '0.5.1',
'vaex-hdf5': '0.11.1',
'vaex-server': '0.8.0',
'vaex-astro': '0.9.0',
'vaex-jupyter': '0.7.0',
'vaex-ml': '0.16.0',
'vaex-graphql': '0.2.0'}
Vaex was installed via: pip / conda-forge / from source, from source actually
OS: Ubuntu 20.04
The text was updated successfully, but these errors were encountered: