{"action":"created","issue":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/18509","repository_url":"https://api.github.com/repos/pandas-dev/pandas","labels_url":"https://api.github.com/repos/pandas-dev/pandas/issues/18509/labels{/name}","comments_url":"https://api.github.com/repos/pandas-dev/pandas/issues/18509/comments","events_url":"https://api.github.com/repos/pandas-dev/pandas/issues/18509/events","html_url":"https://github.com/pandas-dev/pandas/issues/18509","id":276871025,"number":18509,"title":"BUG: Series.map({}) should retain the original dtype","user":{"login":"jreback","id":953992,"avatar_url":"https://avatars2.githubusercontent.com/u/953992?v=4","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"labels":[{"id":76811,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Bug","name":"Bug","color":"e10c02","default":false},{"id":31404521,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Dtypes","name":"Dtypes","color":"e102d8","default":false},{"id":2822342,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Missing-data","name":"Missing-data","color":"d7e102","default":false},{"id":13098779,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Reshaping","name":"Reshaping","color":"02d7e1","default":false}],"state":"open","locked":false,"assignee":{"login":"jreback","id":953992,"avatar_url":"https://avatars2.githubusercontent.com/u/953992?v=4","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"assignees":[{"login":"jreback","id":953992,"avatar_url":"https://avatars2.githubusercontent.com/u/953992?v=4","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/pandas-dev/pandas/milestones/53","html_url":"https://github.com/pandas-dev/pandas/milestone/53","labels_url":"https://api.github.com/repos/pandas-dev/pandas/milestones/53/labels","id":2853937,"number":53,"title":"0.22.0","description":"after 0.21","creator":{"login":"jreback","id":953992,"avatar_url":"https://avatars2.githubusercontent.com/u/953992?v=4","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"open_issues":42,"closed_issues":210,"state":"open","created_at":"2017-10-20T10:17:09Z","updated_at":"2017-11-27T00:59:27Z","due_on":"2017-12-31T08:00:00Z","closed_at":null},"comments":0,"created_at":"2017-11-27T00:23:52Z","updated_at":"2017-11-27T02:06:47Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"https://github.com/pandas-dev/pandas/pull/18491#issuecomment-347050600\r\n\r\n```\r\nIn [1]: pd.Series(pd.date_range(\"2012-01-01\", periods=3)).map({})\r\nOut[1]: \r\n0   NaN\r\n1   NaN\r\n2   NaN\r\ndtype: float64\r\n\r\nIn [2]: pd.date_range(\"2012-01-01\", periods=3).map({})\r\nOut[2]: DatetimeIndex(['NaT', 'NaT', 'NaT'], dtype='datetime64[ns]', freq=None)\r\n```\r\n\r\n[1] should infer to a datetime64 as well\r\n\r\n@jschendel comments\r\n\r\nOn master:\r\n```python\r\nIn [2]: pd.__version__\r\nOut[2]: '0.22.0.dev0+241.gf745e52'\r\n\r\nIn [3]: pd.date_range('20170101', periods=4).map({})\r\nOut[3]: DatetimeIndex(['NaT', 'NaT', 'NaT', 'NaT'], dtype='datetime64[ns]', freq=None)\r\n```\r\n\r\n`IntervalIndex`, `CategoricalIndex`, and `Index` with `object` dtype get coerced to `Float64Index`:\r\n\r\n```python\r\nIn [4]: pd.interval_range(0, 5).map({})\r\nOut[4]: Float64Index([nan, nan, nan, nan, nan], dtype='float64')\r\n\r\nIn [5]: pd.CategoricalIndex(list('abca')).map({})\r\nOut[5]: Float64Index([nan, nan, nan, nan], dtype='float64')\r\n\r\nIn [6]: pd.Index(list('abca')).map({})\r\nOut[6]: Float64Index([nan, nan, nan, nan], dtype='float64')\r\n```\r\n\r\n`PeriodIndex` and `TimedeltaIndex` get coerced `DatetimeIndex`:\r\n```python\r\nIn [7]: pd.period_range('2017Q1', periods=4, freq='Q').map({})\r\nOut[7]: DatetimeIndex(['NaT', 'NaT', 'NaT', 'NaT'], dtype='datetime64[ns]', freq=None)\r\n\r\nIn [8]: pd.timedelta_range(1, periods=4).map({})\r\nOut[8]: DatetimeIndex(['NaT', 'NaT', 'NaT', 'NaT'], dtype='datetime64[ns]', freq=None)\r\n```"},"comment":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/comments/347060531","html_url":"https://github.com/pandas-dev/pandas/issues/18509#issuecomment-347060531","issue_url":"https://api.github.com/repos/pandas-dev/pandas/issues/18509","id":347060531,"user":{"login":"jreback","id":953992,"avatar_url":"https://avatars2.githubusercontent.com/u/953992?v=4","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"created_at":"2017-11-27T02:06:46Z","updated_at":"2017-11-27T02:06:46Z","author_association":"CONTRIBUTOR","body":"@jschendel yeah [7], and [8] 'work' but should be the correct type (bug I introduced). The others are not well tested (cat / interval), so not surprising they are wrong. [6] also not tested well."}}
{"actor":{"display_login":"jreback"}}