Skip to content

Commit

Permalink
docs: Fix docstrings for ATAN2 and ATAN2D SQL functions (#19351)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Scholten <[email protected]>
  • Loading branch information
janscholten and Jan Scholten authored Oct 25, 2024
1 parent a38dea6 commit 655dd0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions crates/polars-sql/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub(crate) enum PolarsSQLFunctions {
/// ```
Atan,
/// SQL 'atan2' function
/// Compute the inverse tangent of column_2/column_1 (in radians).
/// Compute the inverse tangent of column_1/column_2 (in radians).
/// ```sql
/// SELECT ATAN2(column_1, column_2) FROM df;
/// ```
Expand All @@ -261,7 +261,7 @@ pub(crate) enum PolarsSQLFunctions {
/// ```
AtanD,
/// SQL 'atan2d' function
/// Compute the inverse tangent of column_2/column_1 (in degrees).
/// Compute the inverse tangent of column_1/column_2 (in degrees).
/// ```sql
/// SELECT ATAN2D(column_1) FROM df;
/// ```
Expand Down
32 changes: 16 additions & 16 deletions py-polars/docs/source/reference/sql/functions/trigonometry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Trigonometry
* - :ref:`ATAND <atand>`
- Compute inverse tangent of the input column (in degrees).
* - :ref:`ATAN2 <atan2>`
- Compute the inverse tangent of column_2/column_1 (in radians).
- Compute the inverse tangent of column_1/column_2 (in radians).
* - :ref:`ATAN2D <atan2d>`
- Compute the inverse tangent of column_2/column_1 (in degrees).
- Compute the inverse tangent of column_1/column_2 (in degrees).
* - :ref:`COT <cot>`
- Compute the cotangent of the input column (in radians).
* - :ref:`COTD <cotd>`
Expand Down Expand Up @@ -187,7 +187,7 @@ Compute inverse tangent of the input column (in degrees).

ATAN2
-----
Compute the inverse tangent of column_2/column_1 (in radians).
Compute the inverse tangent of column_1/column_2 (in radians).

**Example:**

Expand Down Expand Up @@ -216,30 +216,30 @@ Compute the inverse tangent of column_2/column_1 (in radians).

ATAN2D
------
Compute the inverse tangent of column_2/column_1 (in degrees).
Compute the inverse tangent of column_1/column_2 (in degrees).

**Example:**

.. code-block:: python
df = pl.DataFrame(
{
"a": [0, 90, 180, 360],
"b": [360, 270, 180, 90],
"a": [-1.0, 0.0, 1.0, 1.0],
"b": [1.0, 1.0, 0.0, -1.0],
}
)
df.sql("SELECT a, b, ATAN2D(a, b) AS atan2d_ab FROM self")
# shape: (4, 3)
# ┌──────────┬───────────┐
# │ a ┆ b ┆ atan2d_ab │
# │ --- ┆ --- ┆ --- │
#i64 ┆ i64 ┆ f64 │
# ╞══════════╪═══════════╡
#0360 ┆ 0.0 │
#90270 ┆ 18.434949
#180 ┆ 180 ┆ 45.0
#360 ┆ 90 ┆ 75.963757
# └──────────┴───────────┘
# ┌──────┬──────┬───────────┐
# │ a ┆ b ┆ atan2d_ab │
# │ --- ┆ --- ┆ --- │
#f64 ┆ f64 ┆ f64 │
# ╞══════╪══════╪═══════════╡
#-1 1.0 135.0
#0.0 1.0 ┆ 90.0
#1.0 ┆ 0.0 ┆ 0.0
#1.0 ┆ -1.0 ┆ -45.0
# └──────┴──────┴───────────┘
.. _cot:

Expand Down

0 comments on commit 655dd0f

Please sign in to comment.