Skip to content

Commit

Permalink
Merge pull request #240 from fatemetardasti96/main
Browse files Browse the repository at this point in the history
update column extension function names and desc in readme
  • Loading branch information
SemyonSinchenko authored Jul 12, 2024
2 parents 494f56e + 7c8ae16 commit e9f8948
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,41 +476,41 @@ from quinn.extensions import *
### Column Extensions
**isFalsy()**
**is_falsy()**
Returns `True` if `has_stuff` is `None` or `False`.
Returns a Column indicating whether all values in the Column are False or NULL: `True` if `has_stuff` is `None` or `False`.
```python
source_df.withColumn("is_stuff_falsy", F.col("has_stuff").isFalsy())
```

**isTruthy()**
**is_truthy()**

Returns `True` unless `has_stuff` is `None` or `False`.
Calculates a boolean expression that is the opposite of is_falsy for the given Column: `True` unless `has_stuff` is `None` or `False`.

```python
source_df.withColumn("is_stuff_truthy", F.col("has_stuff").isTruthy())
```

**isNullOrBlank()**
**is_null_or_blank()**

Returns `True` if `blah` is `null` or blank (the empty string or a string that only contains whitespace).
Returns a Boolean value which expresses whether a given column is NULL or contains only blank characters: `True` if `blah` is `null` or blank (the empty string or a string that only contains whitespace).

```python
source_df.withColumn("is_blah_null_or_blank", F.col("blah").isNullOrBlank())
```

**isNotIn()**
**is_not_in()**

Returns `True` if `fun_thing` is not included in the `bobs_hobbies` list.
To see if a value is not in a list of values: `True` if `fun_thing` is not included in the `bobs_hobbies` list.

```python
source_df.withColumn("is_not_bobs_hobby", F.col("fun_thing").isNotIn(bobs_hobbies))
```

**nullBetween()**
**null_between()**

Returns `True` if `age` is between `lower_age` and `upper_age`. If `lower_age` is populated and `upper_age` is `null`, it will return `True` if `age` is greater than or equal to `lower_age`. If `lower_age` is `null` and `upper_age` is populate, it will return `True` if `age` is lower than or equal to `upper_age`.
To see if a value is between two values in a null friendly way: `True` if `age` is between `lower_age` and `upper_age`. If `lower_age` is populated and `upper_age` is `null`, it will return `True` if `age` is greater than or equal to `lower_age`. If `lower_age` is `null` and `upper_age` is populate, it will return `True` if `age` is lower than or equal to `upper_age`.

```python
source_df.withColumn("is_between", F.col("age").nullBetween(F.col("lower_age"), F.col("upper_age")))
Expand Down
4 changes: 2 additions & 2 deletions quinn/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ def is_falsy(col: Column) -> Column:


def is_truthy(col: Column) -> Column:
"""Calculates a boolean expression that is the opposite of isFalsy for the given ``Column`` col.
"""Calculates a boolean expression that is the opposite of is_falsy for the given ``Column`` col.
:param Column col: The ``Column`` to calculate the opposite of isFalsy for.
:param Column col: The ``Column`` to calculate the opposite of is_falsy for.
:returns: A ``Column`` with the results of the calculation.
:rtype: Column
"""
Expand Down

0 comments on commit e9f8948

Please sign in to comment.