Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/5274#discussion_r27438835
--- Diff: python/pyspark/sql/dataframe.py ---
@@ -697,6 +697,83 @@ def subtract(self, other):
"""
return DataFrame(getattr(self._jdf, "except")(other._jdf),
self.sql_ctx)
+ def dropna(self, how='any', thresh=None, subset=None):
+ """Returns a new :class:`DataFrame` omitting rows with null values.
+
+ :param how: 'any' or 'all'.
+ If 'any', drop a row if it contains any nulls.
+ If 'all', drop a row only if all its values are null.
+ :param thresh: int, default None
+ If specified, drop rows that have less than `thresh` non-null
values.
+ This overwrites the `how` parameter.
+ :param subset: optional list of column names to consider.
+
+ >>> df4.dropna().show()
+ age height name
+ 10 80 Alice
+ """
+ if subset is None:
+ subset = self.columns
+ elif isinstance(subset, basestring):
+ subset = [subset]
+ elif not isinstance(subset, (list, tuple)):
+ raise ValueError("subset should be a list or tuple of column
names")
+
+ if thresh is None:
+ thresh = len(subset) if how == 'any' else 1
--- End diff --
did you mean adding an explicit check?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]