Numindexname
State: closed

- [x] closes #12309
- [x] tests added / passed
- [x] passes `git diff upstream/master | flake8 --diff`
- [x] whatsnew entries: name passing, unsupported `dtype`s, `copy=true` for `DateTimeIndex`

This is a rebased & updated version of #12331

I would say the [last commit](https://github.com/pydata/pandas/pull/13205/commits/cd89efc88afd6fc5b0e973da4338cefdbea52d51) is the most critical one: it exposes the consequences of making numeric indices only support their default `dtype`. By the way: I had interpreted [your comment](https://github.com/pydata/pandas/pull/12331#discussion_r54882912) as "raise if `dtype` is set", but I don't think this is what we want, since it breaks the obj -> str(obj) -> obj roundtrip. So I raise only if `dtype` is not the expected dtype.


Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Compat
description: pandas objects compatability with Numpy or Python functions

Comments:
## [Current coverage](https://codecov.io/gh/pydata/pandas/pull/13205?src=pr) is **84.25%**

> Merging [#13205](https://codecov.io/gh/pydata/pandas/pull/13205?src=pr) into [master](https://codecov.io/gh/pydata/pandas/branch/master?src=pr) will increase coverage by **0.01%**

``` diff
@@             master     #13205   diff @@
==========================================
  Files           138        138          
  Lines         50805      50810     +5   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          42796      42810    +14   
+ Misses         8009       8000     -9   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last updated by [62b4327...9d93fea](https://codecov.io/gh/pydata/pandas/compare/62b4327c9b60d890b1d404cddf3a4244254346a8...9d93fea36ba7ead653a803b4f57bc1ed56493423)

Removed `dtype` check and the related tests. Sorry for filling up the Travis queue... three of the tests can be canceled.

(removed code for name handling in `MultiIndex`, which is now special-cased in the relative test)

If I move tests in `pandas/indexes/test_base.py`, wouldn't I have to rewrite them to only apply to one type of `Index` (or a couple of them), rather than all of them?! For now, I moved them just above `test_copy_and_deepcopy`, which is somewhat related.

look at `tests/indexes/common.py`

Is this a joke?! My tests _are_ in `tests/indexes/common.py`,

> Is this a joke?! My tests are in tests/indexes/common.py,

you must have moved them; last I looked they were not. I will review again at some point.

The two tests never moved from `tests/indexes/common.py` in this PR.

(waiting for some feedback on my last two comments, then will update)

(Actually,  79e3913 does not have much to do with 03248d6...)

Apart from that, I isolated the last changes just for ease of reading, tell me if you prefer me to squash them.

ping...

looks pretty good. pls squash down.

@sinhrks 

Done!

Added the new tests, will have to update a couple of calls when we decide what to do in #13355, but that can be done there, and I wouldn't wait (at least, I personally don't want to spend more time on this PR).

@toobaz no this looks fine. just wanted @sinhrks to have a look.

#13355 can fix it if desired (but to be honest that is lessening the strictness of tests), but can decide there.

ping @sinhrks 

Thx for update. Few minor comments.

@sinhrks done, thanks

( @jreback : I think we're ready)

thanks @toobaz the internal refactorings can take some time. great for sticking with it!

Hope I've learned a bit that will help me need less passages next time ;-)