WIP: prototype for unit support #10349 
State: closed

Trying to follow @jreback idea of adding a dtype for holding the unit.

Related to issue #10349 
- [ ] closes #xxxx
 - [ ] tests added / passed (incomplete tests)
 - [ ] passes ``git diff upstream/master -u -- "*.py" | flake8 --diff`` (except for one warning)
 - [ ] whatsnew entry


Labels:
name: Enhancement
name: Dtype Conversions
description: Unexpected or buggy dtype conversions

Comments:
Hello @Bernhard10! Thanks for updating the PR.



 - In the file [`pandas/core/dtypes/costum_dtypes.py`](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py), following are the PEP8 issues :

> [Line 10:1](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L10): [E302](https://duckduckgo.com/?q=pep8%20E302) expected 2 blank lines, found 1
> [Line 10:40](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L10): [E261](https://duckduckgo.com/?q=pep8%20E261) at least two spaces before inline comment
> [Line 16:1](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L16): [E302](https://duckduckgo.com/?q=pep8%20E302) expected 2 blank lines, found 1
> [Line 42:5](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L42): [E303](https://duckduckgo.com/?q=pep8%20E303) too many blank lines (2)
> [Line 46:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L46): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (93 > 79 characters)
> [Line 48:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L48): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (82 > 79 characters)
> [Line 56:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L56): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (80 > 79 characters)
> [Line 67:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L67): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (83 > 79 characters)
> [Line 90:38](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L90): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 90:40](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L90): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 92:1](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L92): [E302](https://duckduckgo.com/?q=pep8%20E302) expected 2 blank lines, found 1
> [Line 98:18](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L98): [E201](https://duckduckgo.com/?q=pep8%20E201) whitespace after '['
> [Line 99:5](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L99): [E301](https://duckduckgo.com/?q=pep8%20E301) expected 1 blank line, found 0
> [Line 101:13](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L101): [E265](https://duckduckgo.com/?q=pep8%20E265) block comment should start with '# '
> [Line 108:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L108): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (81 > 79 characters)
> [Line 109:50](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L109): [E261](https://duckduckgo.com/?q=pep8%20E261) at least two spaces before inline comment
> [Line 109:51](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L109): [E262](https://duckduckgo.com/?q=pep8%20E262) inline comment should start with '# '
> [Line 109:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L109): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (97 > 79 characters)
> [Line 139:20](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L139): [E226](https://duckduckgo.com/?q=pep8%20E226) missing whitespace around arithmetic operator
> [Line 145:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L145): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (83 > 79 characters)
> [Line 155:13](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L155): [E306](https://duckduckgo.com/?q=pep8%20E306) expected 1 blank line before a nested definition, found 0
> [Line 162:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L162): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (95 > 79 characters)
> [Line 167:13](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L167): [E306](https://duckduckgo.com/?q=pep8%20E306) expected 1 blank line before a nested definition, found 0
> [Line 170:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L170): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (93 > 79 characters)
> [Line 185:42](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L185): [E261](https://duckduckgo.com/?q=pep8%20E261) at least two spaces before inline comment
> [Line 185:43](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/dtypes/costum_dtypes.py#L185): [E262](https://duckduckgo.com/?q=pep8%20E262) inline comment should start with '# '

 - In the file [`pandas/core/ops.py`](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/ops.py), following are the PEP8 issues :

> [Line 335:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/ops.py#L335): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (98 > 79 characters)
> [Line 345:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/ops.py#L345): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (83 > 79 characters)
> [Line 347:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/ops.py#L347): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (89 > 79 characters)
> [Line 349:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/ops.py#L349): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (85 > 79 characters)

 - In the file [`pandas/core/series.py`](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/series.py), following are the PEP8 issues :

> [Line 154:80](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/core/series.py#L154): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (80 > 79 characters)









 - In the file [`pandas/tests/dtypes/test_costum.py`](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py), following are the PEP8 issues :

> [Line 14:1](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L14): [E302](https://duckduckgo.com/?q=pep8%20E302) expected 2 blank lines, found 1
> [Line 15:21](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L15): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 15:23](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L15): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 15:25](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L15): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 15:27](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L15): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 15:29](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L15): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 15:39](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L15): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 15:41](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L15): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 17:21](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L17): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 18:20](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L18): [E225](https://duckduckgo.com/?q=pep8%20E225) missing whitespace around operator
> [Line 20:1](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L20): [E302](https://duckduckgo.com/?q=pep8%20E302) expected 2 blank lines, found 1
> [Line 21:21](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L21): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 21:23](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L21): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 21:25](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L21): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 21:27](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L21): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 21:29](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L21): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 21:39](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L21): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 21:41](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L21): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 23:37](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L23): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 23:40](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L23): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 23:43](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L23): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 23:46](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L23): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 23:49](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L23): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 23:60](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L23): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 23:62](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L23): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 24:36](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L24): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 24:38](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L24): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 24:40](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L24): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 24:42](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L24): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 24:44](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L24): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 24:54](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L24): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 24:56](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L24): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 25:36](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L25): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 25:38](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L25): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 25:40](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L25): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 25:42](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L25): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 25:44](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L25): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 25:54](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L25): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 25:56](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L25): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 29:21](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L29): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 29:23](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L29): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 29:25](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L29): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 29:27](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L29): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 29:29](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L29): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 29:39](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L29): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 29:41](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L29): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 34:21](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L34): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 34:23](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L34): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 34:25](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L34): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 34:27](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L34): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 34:29](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L34): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 34:39](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L34): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 34:41](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L34): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 35:21](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L35): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 35:23](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L35): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 35:25](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L35): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 35:27](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L35): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 35:29](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L35): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 35:39](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L35): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 35:41](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L35): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 36:21](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L36): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 36:23](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L36): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 36:25](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L36): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 36:27](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L36): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 36:29](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L36): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 36:39](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L36): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals
> [Line 36:41](https://github.com/pandas-dev/pandas/blob/950d922efc7faf6c7700aea7aa7cef021d85131b/pandas/tests/dtypes/test_costum.py#L36): [E251](https://duckduckgo.com/?q=pep8%20E251) unexpected spaces around keyword / parameter equals



##### Comment last updated on August 03, 2017 at 10:49 Hours UTC
If I am allowed to store the dtype in the Series class (for some reason I assumed I was not allowed to do this), then everything is indeed there already in pandas.

The latest commit stored the dtype directly in Series and works straight forward now.
Obviously more tests for edge-cases have to be added.

The next step would be to remove the direct dependency on pint and make it generic.
With Series storing the dtype, everything else seems to perfectly fall in place.

The current state of the code has (currently) nothing to do with units, but provides a framework how
unit libraries could subclass pandas `ExtensionDtype`. Since `ExtentionDtype` subclasses like DatetimeTZDtype have a lot of special handling all over pandas, I had to subclass `ExtensionType` creating the "abstract" dtype `NumpyDtypeWithMetadata`.

The idea of `NumpyDtypeWithMetadata` is to define an interface for dtypes that store the data in a numpy-compatible dtype but where the dtype holds additional information and defines its own operations.

There is still some work to do:

*) this works only with Series, not with SparseSeries etc.
*) Thus, not all tests pass
*) getting the dtype from a string does not work. It probably will never work, because the actual subclasses of `NumpyDtypeWithMetadata` would be provided by libraries like pint.
*) More thorough testing for edge cases is needed
*) How about indices.


Unfortunately I currently have no time to complete this pull-request, but I will continue to work on it in September, if the basic direction of where this is going is deemed fitting for pandas. Then I could also provide a sample implementation for the use with Pint.
@Bernhard10 welcome to have this, though this would require extensive effort / testing, e.g. see for example #16015 
@Bernhard10 good effort here. going to close. but if you would like to continue working you certainly can. This would need extensive testing in order to be accepted I think.
Thanks for the feedback and sorry for the delayed response.

I hope I will find time to continue working on this.