@@ -322,14 +322,14 @@ def _populate_impl_map(self) -> Dict[str, Callable]:
322322 "as_int64" : lambda x : x .astype ("int64" ).copy (),
323323 "as_str" : lambda x : x .astype ("str" ).copy (),
324324 "trimstr" : lambda x , start , stop : x .str .slice (start = start , stop = stop ),
325- "datetime_to_date" : lambda x : x .dt .date .copy (),
325+ "datetime_to_date" : lambda x : self . pd . to_datetime ( x ) .dt .date .copy (),
326326 "parse_datetime" : lambda x , format : self .pd .to_datetime (
327327 x , format = format
328328 ),
329329 "parse_date" : lambda x , format : self .pd .to_datetime (
330330 x , format = format
331331 ).dt .date .copy (),
332- "format_datetime" : lambda x , format : x .dt .strftime (date_format = format ),
332+ "format_datetime" : lambda x , format : self . pd . to_datetime ( x ) .dt .strftime (date_format = format ),
333333 "format_date" : lambda x , format : self .pd .to_datetime (
334334 x
335335 ).dt .strftime (date_format = format ),
@@ -343,22 +343,12 @@ def _populate_impl_map(self) -> Dict[str, Callable]:
343343 )
344344 % 7
345345 ),
346- "dayofyear" : lambda x : self .pd .to_datetime (x )
347- .dt .dayofyear .astype ("int64" )
348- .copy (),
346+ "dayofyear" : lambda x : self .pd .to_datetime (x ).dt .dayofyear .astype ("int64" ).copy (),
349347 "weekofyear" : lambda x : self ._calc_week_of_Year (x ),
350- "dayofmonth" : lambda x : self .pd .to_datetime (x )
351- .dt .day .astype ("int64" )
352- .copy (),
353- "month" : lambda x : self .pd .to_datetime (x )
354- .dt .month .astype ("int64" )
355- .copy (),
356- "quarter" : lambda x : self .pd .to_datetime (x )
357- .dt .quarter .astype ("int64" )
358- .copy (),
359- "year" : lambda x : self .pd .to_datetime (x )
360- .dt .year .astype ("int64" )
361- .copy (),
348+ "dayofmonth" : lambda x : self .pd .to_datetime (x ).dt .day .astype ("int64" ).copy (),
349+ "month" : lambda x : self .pd .to_datetime (x ).dt .month .astype ("int64" ).copy (),
350+ "quarter" : lambda x : self .pd .to_datetime (x ).dt .quarter .astype ("int64" ).copy (),
351+ "year" : lambda x : self .pd .to_datetime (x ).dt .year .astype ("int64" ).copy (),
362352 "timestamp_diff" : lambda c1 , c2 : [
363353 self .pd .Timedelta (c1 [i ] - c2 [i ]).total_seconds ()
364354 for i in range (len (c1 ))
0 commit comments