Strictly monotonic
State: closed

Closes https://github.com/pandas-dev/pandas/issues/16515

I think this can go in 0.20.2, even though part of it is a (small) enhancement.

Labels:
name: Bug
name: Enhancement
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=h1) Report
> Merging [#16555](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/03d44f3dd0ffd55d7538b67466cf4d3899ceac27?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/16555/graphs/tree.svg?width=650&height=150&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16555      +/-   ##
==========================================
+ Coverage   90.75%   90.75%   +<.01%     
==========================================
  Files         161      161              
  Lines       51074    51078       +4     
==========================================
+ Hits        46353    46357       +4     
  Misses       4721     4721
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.59% <100%> (ø)` | :arrow_up: |
| #single | `40.16% <40%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `95.75% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.33% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=footer). Last update [03d44f3...dcd38f0](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=h1) Report
> Merging [#16555](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/03d44f3dd0ffd55d7538b67466cf4d3899ceac27?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/16555/graphs/tree.svg?token=eZ4WkYLtcO&width=650&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16555      +/-   ##
==========================================
+ Coverage   90.75%   90.75%   +<.01%     
==========================================
  Files         161      161              
  Lines       51074    51078       +4     
==========================================
+ Hits        46353    46357       +4     
  Misses       4721     4721
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.59% <100%> (ø)` | :arrow_up: |
| #single | `40.16% <40%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.33% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `95.75% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=footer). Last update [03d44f3...dcd38f0](https://codecov.io/gh/pandas-dev/pandas/pull/16555?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Would dask like to use those `is_strictly_monotonic_increasing` ? Otherwise keeping them private to not further increase number of methods is also an option.

If we keep public, would put some See also's referring to the other
lgtm. merge away.
thanks!
Asking again, as you merged without responding to my comment: is it needed to add this to the public API? It there demand for this attribute? 
If there is not an actual usecase (apart from the internal usage to fix the bug), I would consider making them not public
I'm slightly in favor of having it public. In terms of cognitive load, this feels like half an additional method, rather than 2 additional methods 😄  Just since these are so similar to `is_monotonic_increasing` and decreasing in name and functionality.

But happy hide it if you want.
> In terms of cognitive load, this feels like half an additional method, rather than 2 additional methods :smile: Just since these are so similar to is_monotonic_increasing

Yes, but in tab completion they don't appear together, so I would say it is back to a full additional method in feeling :-)

Since it is very easy to do this yourself as you said above (just combine it with `is_unique`), I would rather add that as an example to the docs and leave them private
> Since it is very easy to do this yourself as you said above (just combine it with is_unique), I would rather add that as an example to the docs and leave them private
 
Perhaps I'm slow, but it took me a day to realize that strictly monotonic = monotonic & unique 😆 

PR is at https://github.com/pandas-dev/pandas/pull/16576 Let's hide it for now, and if anyone asks for it we can make it public.
@jorisvandenbossche I thought this was fine. yes its a a convience method. Sure you *can* do it, but why not. ok with re-hiding it as @TomAugspurger PR.