-
Notifications
You must be signed in to change notification settings - Fork 17
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
Lubridate commands #56
Comments
Have you tried this: https://pwwang.github.io/datar/api/datar.base.date/#datar.base.date.as_date
It's not in a recent plan. If we put it on the agenda, I guess an independent python package will be a better way to implement it. But before that, I think we should have some temporary solutions for datetimes via |
I tried the following and it did not work.
|
That's because Try this: aapl['Date'] = as_date(aapl.Date, "%b %d, %Y") The default formats
|
I also tried the following and also did not work. |
That a good cache actually. >>> df = tibble(d="Sep 16, 2021")
>>> df >> mutate(date=as_date(f.d, "%b %d, %Y"))
d date
<object> <object>
0 Sep 16, 2021 2021-09-16
>>> df2 = df >> mutate(date=as_date(f.d, "%b %d, %Y"))
>>> df2.date
0 2021-09-16
Name: date, dtype: object
>>> type(df2.date[0])
<class 'datetime.date'>
>>> df2["dd"] = pd.to_datetime(df2.date)
>>> df2
d date dd
<object> <object> <datetime64[ns]>
0 Sep 16, 2021 2021-09-16 2021-09-16 Need to add one more layer to turn |
* 📝 Add documentation for the "blind" environments (#45, #54, #55) * 🩹 Fix trimws not importable from datar.all/datar.base * ✨ Make as_date() return pd datetime types; Add as_pd_date() as an alias of pd.to_datetime() (#56) * 🔖 0.5.1 * 🚨 Fix linting * 👷 Deploy the docs on dev branch as well * 💚 Fix docs deply in CI
At v0.5.1, Let me know if it solves your problem. |
@pwwang, thank you very much for the update
however,
AttributeError: REGULAR
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-10-d566a4235cfd> in <module>
----> 1 aapl >> mutate(Date = as_date(f.Date))
D:\Anaconda3\lib\site-packages\pipda\function.py in _pipda_eval(self, data, context)
94 # leave args/kwargs for the child
95 # verb/function/operator to evaluate
---> 96 return func(*bondargs.args, **bondargs.kwargs) # type: ignore
97
98 args = evaluate_expr(
D:\Anaconda3\lib\functools.py in wrapper(*args, **kw)
873 '1 positional argument')
874
--> 875 return dispatch(args[0].__class__)(*args, **kw)
876
877 funcname = getattr(func, '__name__', 'singledispatch function')
D:\Anaconda3\lib\site-packages\datar\dplyr\mutate.py in mutate(_data, _keep, _before, _after, base0_, *args, **kwargs)
97 # out.columns.difference(removed)
98 # changes column order when removed == []
---> 99 out = out[setdiff(out.columns, removed, __calling_env=CallingEnvs.REGULAR)]
100 if _before is not None or _after is not None:
101 new = setdiff(
D:\Anaconda3\lib\enum.py in __getattr__(cls, name)
382 return cls._member_map_[name]
383 except KeyError:
--> 384 raise AttributeError(name) from None
385
386 def __getitem__(cls, name):
|
You may have an older version of See what prints from |
Here is mine:
You should definitely upgrade |
It really should. It didn't because I used a very wild version specification for it But yeah, I will try to add more specific versions for those dependencies, probably starting the next version, since those dependencies are pretty stable now. |
Thanks @pwwang! |
No problem. Closing this for now. Feel free to open new issues if you have other questions. |
Hi @pwwang , do you have plans to add
lubridate
commands todatar
?I am trying to convert the Date column on stock time series data to date time with
datar
mutate
.Data from yahoo finance
The text was updated successfully, but these errors were encountered: