DOC: behavior when slicing with missing bounds
State: closed

 - [x] closes #16917
 - [ ] tests added / passed
 - [x] passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff`` (On Windows, ``git diff upstream/master -u -- "*.py" | flake8 --diff`` might work as an alternative.)
 - [ ] whatsnew entry

This documents the behavior discussed in #16917. I don't have time now to produce tests (and I suspect some already exist), so feel free to not close that issue, or to open a new one for tests only.

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

Comments:
> @toobaz : you will need to test this too!

Are you jocking?! Did you read above?
Maybe adding a note box instead would be more clear, showing a situation where this could work and where it doesn't work. 

Putting this in the headline docs is a non-starter.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16932?src=pr&el=h1) Report
> Merging [#16932](https://codecov.io/gh/pandas-dev/pandas/pull/16932?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/6858d0f6caa60c98acc4b6c3eaa6cd0309aedca6?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #16932      +/-   ##
==========================================
- Coverage   90.99%   90.98%   -0.02%     
==========================================
  Files         161      161              
  Lines       49306    49306              
==========================================
- Hits        44868    44859       -9     
- Misses       4438     4447       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.75% <ø> (ø)` | :arrow_up: |
| #single | `40.19% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16932?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/16932?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/16932?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.71% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16932?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/16932?src=pr&el=footer). Last update [6858d0f...cfd05f4](https://codecov.io/gh/pandas-dev/pandas/pull/16932?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/16932?src=pr&el=h1) Report
> Merging [#16932](https://codecov.io/gh/pandas-dev/pandas/pull/16932?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/148e038bfaf2a3893b52e28b6469cf5984eec794?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #16932      +/-   ##
==========================================
- Coverage   90.99%   90.97%   -0.02%     
==========================================
  Files         161      161              
  Lines       49290    49290              
==========================================
- Hits        44851    44842       -9     
- Misses       4439     4448       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.74% <ø> (ø)` | :arrow_up: |
| #single | `40.19% <ø> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16932?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/16932?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/16932?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.76% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16932?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/16932?src=pr&el=footer). Last update [148e038...2c61370](https://codecov.io/gh/pandas-dev/pandas/pull/16932?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

> Are you jocking?! Did you read above?

It's been a long day, man.  I did not see that. :smile: 
@toobaz : I would prefer to merge only if there were tests.  As you don't have time to do this, I will go ahead and write tests for it unless @tdpetrou wants to jump in.
BTW, I should add that the doc changes look pretty reasonable.  As I said before, adding tests (if you have time) would make this merge-able.  Otherwise, we can take care of that.
> BTW, I should add that the doc changes look pretty reasonable.

Cool, thanks. I did put writing those tests (and, first, searching for existing ones) in my pandas TODO list, but frankly speaking it's not very high.
@toobaz : I presume you have allowed edits by maintainers, so I think what we can do is add the missing tests to your branch if you don't have the time.  Then, we can merge this.  How does that sound?
> @toobaz : I presume you have allowed edits by maintainers, so I think what we can do is add the missing tests to your branch if you don't have the time. Then, we can merge this. How does that sound?

Sure, that would be great!
> what we can do is add the missing tests to your branch

Notice the feature I'm describing is actually already tested at several places, including:
https://github.com/pandas-dev/pandas/blob/master/pandas/tests/indexing/test_floats.py#L387
https://github.com/pandas-dev/pandas/blob/master/pandas/tests/indexing/test_floats.py#L502
https://github.com/pandas-dev/pandas/blob/master/pandas/tests/indexing/test_floats.py#L553
https://github.com/pandas-dev/pandas/blob/master/pandas/tests/indexing/test_floats.py#L593
https://github.com/pandas-dev/pandas/blob/master/pandas/tests/indexing/test_loc.py#L307
with floats, ints and datetimes - but possibly never with strings, which were the main concern in #16917.
ignore pep failure I just fixed
> some nitpicky comments. you can just ping when pushed.

@jreback ping
I think given the issue you're addressing, an example like what @tdpetrou provided might be useful.

@jreback : I was thinking that we should add tests before merging this?
thansks @toobaz 

this is tested in several places. 

Separate issue is whether we want to try show a warning on non-sorted selections.
> this is tested in several places.

But with partial strings though?  That's what I wasn't sure about.