0

I am working on replacing Pandas library to Koalas Library in my python repo in VS Code. But Koalas module does not seem to have DateOffset() module similar to what pandas has.

I tried this :

import databricks.koalas as ks 
kdf["date_col_2"] = kdf["date_col_1"] - ks.DateOffset(months=cycle_info_gap)

It results in the below error :

AttributeError: module 'databricks.koalas' has no attribute 'DateOffset'

Is there any alternative for this in Koalas?

user19930511
  • 299
  • 2
  • 15

1 Answers1

0
df.time.map(lambda x:x+pd.DateOffset(days=2))

out

0   2022-05-20 18:10:50.021831
1   2022-05-26 09:48:39.787426
2   2022-05-26 16:06:18.765405
3   2022-05-27 03:04:01.860841
4   2022-05-28 05:01:08.335874
5   2022-06-02 03:57:15.060167
6   2022-06-02 06:32:37.177199
Name: time, dtype: datetime64[ns]
G.G
  • 639
  • 1
  • 5