We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
datetime.datetime
types.TimestampType()
Actually, this isn't an issue. I was looking for a workaround for this comment, wrote the code below and got ValueError.
ValueError
import databricks.koalas as ks from datetime import datetime, timedelta def tomorrow(date) -> datetime: return date + timedelta(days=1) test_df = ks.DataFrame([(datetime(2019, 10, 24))], columns=['date']) test_df['date'] = test_df['date'].map(tomorrow) >>> test_df ... ValueError: Invalid returnType: returnType can not be None
The cause is that datetime.datetime is not recognized as the equivalent python type to types.TimestampType().
_base = { types.StringType(): [str, 'str', 'string'], types.BinaryType(): [bytes], types.ByteType(): [np.int8, 'int8', 'byte'], types.ShortType(): [np.int16, 'int16', 'short'], types.IntegerType(): [int, 'int', np.int, np.int32], types.LongType(): [np.int64, 'int64', 'long', 'bigint'], types.FloatType(): [float, 'float', np.float], types.DoubleType(): [np.float64, 'float64', 'double'], types.TimestampType(): [np.datetime64], # <- should be included here. types.DateType(): [datetime.date], types.BooleanType(): [bool, 'boolean', 'bool', np.bool], types.ArrayType(types.StringType()): [] }
https://github.com/databricks/koalas/blob/master/databricks/koalas/typedef.py#L112
I think datetime.datetime should be included in types.TimestampType().
@ueshin @HyukjinKwon What do you think?
The text was updated successfully, but these errors were encountered:
Oh, yes. looks like we should add. It works in pandas right?
Sorry, something went wrong.
Let me check if this code works when using pandas instead of koalas.
pandas
koalas
It worked with pandas. I'll create a PR.
Add datetime as the equivalent python type to TimestampType (#957)
8303ab1
Resolves #951
Successfully merging a pull request may close this issue.
Actually, this isn't an issue. I was looking for a workaround for this comment, wrote the code below and got
ValueError
.The cause is that
datetime.datetime
is not recognized as the equivalent python type totypes.TimestampType()
.https://github.com/databricks/koalas/blob/master/databricks/koalas/typedef.py#L112
I think
datetime.datetime
should be included intypes.TimestampType()
.@ueshin @HyukjinKwon What do you think?
The text was updated successfully, but these errors were encountered: