---
source: crates/ruff_linter/src/rules/pandas_vet/mod.rs
snapshot_kind: text
---
PD101.py:7:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
  |
6 | # PD101
7 | data.nunique() <= 1
  | ^^^^^^^^^^^^^^^^^^^ PD101
8 | data.nunique(dropna=True) <= 1
9 | data.nunique(dropna=False) <= 1
  |

PD101.py:8:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
   |
 6 | # PD101
 7 | data.nunique() <= 1
 8 | data.nunique(dropna=True) <= 1
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PD101
 9 | data.nunique(dropna=False) <= 1
10 | data.nunique() == 1
   |

PD101.py:9:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
   |
 7 | data.nunique() <= 1
 8 | data.nunique(dropna=True) <= 1
 9 | data.nunique(dropna=False) <= 1
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PD101
10 | data.nunique() == 1
11 | data.nunique(dropna=True) == 1
   |

PD101.py:10:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
   |
 8 | data.nunique(dropna=True) <= 1
 9 | data.nunique(dropna=False) <= 1
10 | data.nunique() == 1
   | ^^^^^^^^^^^^^^^^^^^ PD101
11 | data.nunique(dropna=True) == 1
12 | data.nunique(dropna=False) == 1
   |

PD101.py:11:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
   |
 9 | data.nunique(dropna=False) <= 1
10 | data.nunique() == 1
11 | data.nunique(dropna=True) == 1
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PD101
12 | data.nunique(dropna=False) == 1
13 | data.nunique() != 1
   |

PD101.py:12:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
   |
10 | data.nunique() == 1
11 | data.nunique(dropna=True) == 1
12 | data.nunique(dropna=False) == 1
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PD101
13 | data.nunique() != 1
14 | data.nunique(dropna=True) != 1
   |

PD101.py:13:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
   |
11 | data.nunique(dropna=True) == 1
12 | data.nunique(dropna=False) == 1
13 | data.nunique() != 1
   | ^^^^^^^^^^^^^^^^^^^ PD101
14 | data.nunique(dropna=True) != 1
15 | data.nunique(dropna=False) != 1
   |

PD101.py:14:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
   |
12 | data.nunique(dropna=False) == 1
13 | data.nunique() != 1
14 | data.nunique(dropna=True) != 1
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PD101
15 | data.nunique(dropna=False) != 1
16 | data.nunique() > 1
   |

PD101.py:15:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
   |
13 | data.nunique() != 1
14 | data.nunique(dropna=True) != 1
15 | data.nunique(dropna=False) != 1
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PD101
16 | data.nunique() > 1
17 | data.dropna().nunique() == 1
   |

PD101.py:16:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
   |
14 | data.nunique(dropna=True) != 1
15 | data.nunique(dropna=False) != 1
16 | data.nunique() > 1
   | ^^^^^^^^^^^^^^^^^^ PD101
17 | data.dropna().nunique() == 1
18 | data[data.notnull()].nunique() == 1
   |

PD101.py:17:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
   |
15 | data.nunique(dropna=False) != 1
16 | data.nunique() > 1
17 | data.dropna().nunique() == 1
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PD101
18 | data[data.notnull()].nunique() == 1
   |

PD101.py:18:1: PD101 Using `series.nunique()` for checking that a series is constant is inefficient
   |
16 | data.nunique() > 1
17 | data.dropna().nunique() == 1
18 | data[data.notnull()].nunique() == 1
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PD101
19 | 
20 | # No violation of this rule
   |
