Skip to content

Commit

Permalink
Fix hasnans to follow the modified column. (#1532)
Browse files Browse the repository at this point in the history
Fixing `hasnans` to follow the modified column.

E.g.,

```py
>>> (ks.Series([1.0, 2.0, np.nan]) + 1).hasnans
Traceback (most recent call last):
...
pyspark.sql.utils.AnalysisException: 'Resolved attribute(s) 0#1 missing from (0 + 1)#10 in operator ...
```
  • Loading branch information
ueshin authored May 25, 2020
1 parent d5546c1 commit 050a301
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions databricks/koalas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,16 @@ def hasnans(self):
>>> ks.Series([1, 2, 3]).hasnans
False
>>> (ks.Series([1.0, 2.0, np.nan]) + 1).hasnans
True
>>> ks.Series([1, 2, 3]).rename("a").to_frame().set_index("a").index.hasnans
False
"""
sdf = self._internal._sdf.select(self.spark.column)
col = self.spark.column
sdf = self._internal.spark_frame
scol = self.spark.column

ret = sdf.select(F.max(col.isNull() | F.isnan(col))).collect()[0][0]
return ret
return sdf.select(F.max(scol.isNull() | F.isnan(scol))).collect()[0][0]

@property
def is_monotonic(self):
Expand Down

0 comments on commit 050a301

Please sign in to comment.