You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Prakhar Sandhu (Jira)" <ji...@apache.org> on 2022/03/22 21:03:00 UTC

[jira] [Updated] (SPARK-38627) TypeError: Datetime subtraction can only be applied to datetime series

     [ https://issues.apache.org/jira/browse/SPARK-38627?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Prakhar Sandhu updated SPARK-38627:
-----------------------------------
    Description: 
I am trying to replace pandas with pyspark.pandas library, when I tried this :

pdf is a pyspark.pandas dataframe
{code:java}
pdf["date_diff"] = pdf["date1"] - pdf["date2"] {code}
I got the below error :
{code:java}
File "C:\Users\abc\Anaconda3\envs\test\lib\site-packages\pyspark\pandas\data_type_ops\datetime_ops.py", line 75, in sub
raise TypeError("Datetime subtraction can only be applied to datetime series.") {code}

 

  was:
I am trying to replace pandas with pyspark.pandas library, when I tried this :

pdf is a pyspark.pandas dataframe
pdf["date_diff"] = pdf["date1"] - pdf["date2"]
I got the below error :
File "C:\Users\abc\Anaconda3\envs\test\lib\site-packages\pyspark\pandas\data_type_ops\datetime_ops.py", line 75, in sub
raise TypeError("Datetime subtraction can only be applied to datetime series.")
 


> TypeError: Datetime subtraction can only be applied to datetime series
> ----------------------------------------------------------------------
>
>                 Key: SPARK-38627
>                 URL: https://issues.apache.org/jira/browse/SPARK-38627
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark
>    Affects Versions: 3.0.0
>            Reporter: Prakhar Sandhu
>            Priority: Major
>
> I am trying to replace pandas with pyspark.pandas library, when I tried this :
> pdf is a pyspark.pandas dataframe
> {code:java}
> pdf["date_diff"] = pdf["date1"] - pdf["date2"] {code}
> I got the below error :
> {code:java}
> File "C:\Users\abc\Anaconda3\envs\test\lib\site-packages\pyspark\pandas\data_type_ops\datetime_ops.py", line 75, in sub
> raise TypeError("Datetime subtraction can only be applied to datetime series.") {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org