
GITHUB . COM {
}
Detected CMS Systems:
- Wordpress (2 occurrences)
Title:
BUG: DataFrame and Series constructor inconsistent in handling of Datetimelike object index Β· Issue #39307 Β· pandas-dev/pandas
Description:
I have checked that this issue has not already been reported. (Looked through and could not find anything) I have confirmed this bug exists on the latest version of pandas. (optional) I have confirmed this bug exists on the master branch...
Website Age:
17 years and 9 months (reg. 2007-10-09).
Matching Content Categories {π}
- Technology & Computing
- Video & Online Content
- Personal Finance
Content Management System {π}
What CMS is github.com built with?
Github.com is based on WORDPRESS.
Traffic Estimate {π}
What is the average monthly size of github.com audience?
ππ Tremendous Traffic: 10M - 20M visitors per month
Based on our best estimate, this website will receive around 10,666,346 visitors per month in the current month.
check SE Ranking
check Ahrefs
check Similarweb
check Ubersuggest
check Semrush
How Does Github.com Make Money? {πΈ}
Subscription Packages {π³}
We've located a dedicated page on github.com that might include details about subscription plans or recurring payments. We identified it based on the word pricing in one of its internal links. Below, you'll find additional estimates for its monthly recurring revenues.How Much Does Github.com Make? {π°}
Subscription Packages {π³}
Prices on github.com are in US Dollars ($).
They range from $4.00/month to $21.00/month.
We estimate that the site has approximately 5,347,483 paying customers.
The estimated monthly recurring revenue (MRR) is $22,459,429.
The estimated annual recurring revenues (ARR) are $269,513,148.
Wordpress Themes and Plugins {π¨}
What WordPress theme does this site use?
It is strange but we were not able to detect any theme on the page.
What WordPress plugins does this website use?
It is strange but we were not able to detect any plugins on the page.
Keywords {π}
file, line, index, issue, pandas, bug, return, member, datetime, sign, series, object, dtype, team, constructors, discussion, jbrockmendel, projects, constructor, behavior, homedeveloperpycharmprojectspandaspandascoreindexingpy, axisaxis, commented, deprecation, navigation, open, code, pull, requests, actions, security, dataframe, inconsistent, handling, datetimelike, closed, description, phofl, confirmed, exists, information, dtypeobject, indexidx, datetimeindex, expected, dfloc, traceback, recent, call, homedeveloperpycharmprojectspandaspandascoreindexesbasepy,
Topics {βοΈ}
/home/developer/anaconda3/envs/omi_reports/pandas-dev/lib/python3 /home/developer/pycharmprojects/pandas/pandas/core/indexes/base /home/developer/pycharmprojects/pandas/pandas/core/generic /home/developer/pycharmprojects/pandas/pandas/core/indexing 8/site-packages/ipython/core/interactiveshell array constructors core team pandas index related index[datetime objects] pandas/_libs/hashtable_class_helper pandas/_libs/index dtype='datetime64[ns]' reopen bug/depr object-dtype index series constructor inconsistent discussion requires discussion comment metadata assignees personal information bug current behavior leads datetime objects fix unwanted warnings import pandas dtype=object dtype='object' series constructor type projects projects milestone 2 series behavior problem description indexing warnings issue bug exists index=idx pandas df = pd triage issue deprecating ser = pd index class code sample object val err keyerror dataframe latest version master branch guide detailing copy-pastable nice feature weird situations recent call
Payment Methods {π}
- Braintree
Questions {β}
- Already have an account?
Schema {πΊοΈ}
DiscussionForumPosting:
context:https://schema.org
headline:BUG: DataFrame and Series constructor inconsistent in handling of Datetimelike object index
articleBody:- [x] I have checked that this issue has not already been reported. (Looked through and could not find anything)
- [x] I have confirmed this bug exists on the latest version of pandas.
- [x] (optional) I have confirmed this bug exists on the master branch of pandas.
---
**Note**: Please read [this guide](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports) detailing how to provide the necessary information for us to reproduce your bug.
#### Code Sample, a copy-pastable example
```python
import pandas as pd
idx = pd.Index([pd.Timestamp("2011-01-01")], dtype=object)
ser = pd.Series([1], index=idx)
df = pd.DataFrame([1], index=idx)
ser.index
Out[4]: DatetimeIndex(['2011-01-01'], dtype='datetime64[ns]', freq=None)
df.index
Out[5]: Index([2011-01-01 00:00:00], dtype='object')
```
#### Problem description
The behavior should be consistent, but not sure what to expected here. The inference is a nice feature although.
The current behavior leads to weird situations with indexing:
```
ser.loc["2011"]
Out[7]:
2011-01-01 1
dtype: int64
```
works while
```
df.loc["2011"]
Traceback (most recent call last):
File "/home/developer/PycharmProjects/pandas/pandas/core/indexes/base.py", line 3225, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
cpdef get_loc(self, object val):
File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc
return self.mapping.get_item(val)
File "pandas/_libs/hashtable_class_helper.pxi", line 5038, in pandas._libs.hashtable.PyObjectHashTable.get_item
cpdef get_item(self, object val):
File "pandas/_libs/hashtable_class_helper.pxi", line 5046, in pandas._libs.hashtable.PyObjectHashTable.get_item
raise KeyError(val)
KeyError: '2011'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/developer/anaconda3/envs/omi_reports/pandas-dev/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-8-59984db8d56a>", line 1, in <module>
df.loc["2011"]
File "/home/developer/PycharmProjects/pandas/pandas/core/indexing.py", line 902, in __getitem__
return self._getitem_axis(maybe_callable, axis=axis)
File "/home/developer/PycharmProjects/pandas/pandas/core/indexing.py", line 1128, in _getitem_axis
return self._get_label(key, axis=axis)
File "/home/developer/PycharmProjects/pandas/pandas/core/indexing.py", line 1077, in _get_label
return self.obj.xs(label, axis=axis)
File "/home/developer/PycharmProjects/pandas/pandas/core/generic.py", line 3752, in xs
loc = index.get_loc(key)
File "/home/developer/PycharmProjects/pandas/pandas/core/indexes/base.py", line 3227, in get_loc
raise KeyError(key) from err
KeyError: '2011'
```
#### Expected Output
Bot returning the same index dtype
#### Output of ``pd.show_versions()``
<details>
INSTALLED VERSIONS
------------------
commit : ff628b17ccfcaf14ceefeb438aafa56d3849937c
python : 3.8.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.8.0-38-generic
Version : #43~20.04.1-Ubuntu SMP Tue Jan 12 16:39:47 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.3.0.dev0+483.gff628b17cc.dirty
numpy : 1.21.0.dev0+438.gbf4ac1f81
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.3
setuptools : 49.6.0.post20201009
Cython : 0.29.21
pytest : 6.1.1
hypothesis : 5.37.1
sphinx : 3.4.3
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : 4.5.2
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.18.1
pandas_datareader: None
bs4 : 4.9.3
bottleneck : 1.3.2
fsspec : 0.8.3
fastparquet : 0.4.1
gcsfs : 0.7.1
matplotlib : 3.3.2
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.5
pandas_gbq : None
pyarrow : 2.0.0
pyxlsb : None
s3fs : 0.4.2
scipy : 1.7.0.dev0+5e9eb01
sqlalchemy : 1.3.20
tables : 3.6.1
tabulate : 0.8.7
xarray : 0.16.1
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.51.2
</details>
author:
url:https://github.com/phofl
type:Person
name:phofl
datePublished:2021-01-20T22:24:16.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:3
url:https://github.com/39307/pandas/issues/39307
context:https://schema.org
headline:BUG: DataFrame and Series constructor inconsistent in handling of Datetimelike object index
articleBody:- [x] I have checked that this issue has not already been reported. (Looked through and could not find anything)
- [x] I have confirmed this bug exists on the latest version of pandas.
- [x] (optional) I have confirmed this bug exists on the master branch of pandas.
---
**Note**: Please read [this guide](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports) detailing how to provide the necessary information for us to reproduce your bug.
#### Code Sample, a copy-pastable example
```python
import pandas as pd
idx = pd.Index([pd.Timestamp("2011-01-01")], dtype=object)
ser = pd.Series([1], index=idx)
df = pd.DataFrame([1], index=idx)
ser.index
Out[4]: DatetimeIndex(['2011-01-01'], dtype='datetime64[ns]', freq=None)
df.index
Out[5]: Index([2011-01-01 00:00:00], dtype='object')
```
#### Problem description
The behavior should be consistent, but not sure what to expected here. The inference is a nice feature although.
The current behavior leads to weird situations with indexing:
```
ser.loc["2011"]
Out[7]:
2011-01-01 1
dtype: int64
```
works while
```
df.loc["2011"]
Traceback (most recent call last):
File "/home/developer/PycharmProjects/pandas/pandas/core/indexes/base.py", line 3225, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
cpdef get_loc(self, object val):
File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc
return self.mapping.get_item(val)
File "pandas/_libs/hashtable_class_helper.pxi", line 5038, in pandas._libs.hashtable.PyObjectHashTable.get_item
cpdef get_item(self, object val):
File "pandas/_libs/hashtable_class_helper.pxi", line 5046, in pandas._libs.hashtable.PyObjectHashTable.get_item
raise KeyError(val)
KeyError: '2011'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/developer/anaconda3/envs/omi_reports/pandas-dev/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-8-59984db8d56a>", line 1, in <module>
df.loc["2011"]
File "/home/developer/PycharmProjects/pandas/pandas/core/indexing.py", line 902, in __getitem__
return self._getitem_axis(maybe_callable, axis=axis)
File "/home/developer/PycharmProjects/pandas/pandas/core/indexing.py", line 1128, in _getitem_axis
return self._get_label(key, axis=axis)
File "/home/developer/PycharmProjects/pandas/pandas/core/indexing.py", line 1077, in _get_label
return self.obj.xs(label, axis=axis)
File "/home/developer/PycharmProjects/pandas/pandas/core/generic.py", line 3752, in xs
loc = index.get_loc(key)
File "/home/developer/PycharmProjects/pandas/pandas/core/indexes/base.py", line 3227, in get_loc
raise KeyError(key) from err
KeyError: '2011'
```
#### Expected Output
Bot returning the same index dtype
#### Output of ``pd.show_versions()``
<details>
INSTALLED VERSIONS
------------------
commit : ff628b17ccfcaf14ceefeb438aafa56d3849937c
python : 3.8.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.8.0-38-generic
Version : #43~20.04.1-Ubuntu SMP Tue Jan 12 16:39:47 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.3.0.dev0+483.gff628b17cc.dirty
numpy : 1.21.0.dev0+438.gbf4ac1f81
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.3
setuptools : 49.6.0.post20201009
Cython : 0.29.21
pytest : 6.1.1
hypothesis : 5.37.1
sphinx : 3.4.3
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : 4.5.2
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.18.1
pandas_datareader: None
bs4 : 4.9.3
bottleneck : 1.3.2
fsspec : 0.8.3
fastparquet : 0.4.1
gcsfs : 0.7.1
matplotlib : 3.3.2
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.5
pandas_gbq : None
pyarrow : 2.0.0
pyxlsb : None
s3fs : 0.4.2
scipy : 1.7.0.dev0+5e9eb01
sqlalchemy : 1.3.20
tables : 3.6.1
tabulate : 0.8.7
xarray : 0.16.1
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.51.2
</details>
author:
url:https://github.com/phofl
type:Person
name:phofl
datePublished:2021-01-20T22:24:16.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:3
url:https://github.com/39307/pandas/issues/39307
Person:
url:https://github.com/phofl
name:phofl
url:https://github.com/phofl
name:phofl
InteractionCounter:
interactionType:https://schema.org/CommentAction
userInteractionCount:3
interactionType:https://schema.org/CommentAction
userInteractionCount:3
External Links {π}(3)
Analytics and Tracking {π}
- Site Verification - Google
Libraries {π}
- Clipboard.js
- D3.js
- GSAP
- Lodash
Emails and Hosting {βοΈ}
Mail Servers:
- aspmx.l.google.com
- alt1.aspmx.l.google.com
- alt2.aspmx.l.google.com
- alt3.aspmx.l.google.com
- alt4.aspmx.l.google.com
Name Servers:
- dns1.p08.nsone.net
- dns2.p08.nsone.net
- dns3.p08.nsone.net
- dns4.p08.nsone.net
- ns-1283.awsdns-32.org
- ns-1707.awsdns-21.co.uk
- ns-421.awsdns-52.com
- ns-520.awsdns-01.net