Skip to content

Commit

Permalink
[MINOR][DOCS] Adding missing boolean type for replacement value in fi…
Browse files Browse the repository at this point in the history
…llna
  • Loading branch information
Srinivasa Reddy Vundela committed Apr 21, 2017
1 parent 71a8e9d commit 1ec1c0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/pyspark/sql/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ def fillna(self, value, subset=None):
Value to replace null values with.
If the value is a dict, then `subset` is ignored and `value` must be a mapping
from column name (string) to replacement value. The replacement value must be
an int, long, float, or string.
an int, long, float, boolean, or string.
:param subset: optional list of column names to consider.
Columns specified in subset that do not have matching data type are ignored.
For example, if `value` is a string, and subset contains a non-string column,
Expand Down
4 changes: 4 additions & 0 deletions python/pyspark/sql/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1711,6 +1711,10 @@ def test_fillna(self):
self.assertEqual(row.age, None)
self.assertEqual(row.height, None)

# fillna with dictionary for boolean types
row = self.spark.createDataFrame([Row(a=None), Row(a=True)]).fillna({"a": True}).first()
self.assertEqual(row.a, True)

def test_bitwise_operations(self):
from pyspark.sql import functions
row = Row(a=170, b=75)
Expand Down

0 comments on commit 1ec1c0d

Please sign in to comment.