Closed
Description
Code Sample, a copy-pastable example if possible
import pandas as pd
# generate two Series randomly
t1=pd.Series([1.2,2.2,3.0,4,8],index=pd.date_range(start='2015-5-14 00:00:00',end='2015-5-14 00:04:00',freq='T'))
t2=pd.Series([6.5,7.2,8.1,9],index=pd.date_range(start='2015-5-15 00:00:00',end='2015-5-15 00:03:00',freq='T'))
# merge t2 ,t1 -> t3
t3=pd.concat([t2,t1])
key='2015-5-14 00:00:00'
print('type t1 is ',type(t1))
print('type t3 is ',type(t3))
print('(1):',t1[key])
print('(2):',t3[key])
print('(3):',t3[key:key])
Problem description
type t1 is <class 'pandas.core.series.Series'>
type t3 is <class 'pandas.core.series.Series'>
(1): 1.2
(2): 2015-05-14 1.2
dtype: float64
(3): 2015-05-14 1.2
dtype: float64
- firstly I concat t1 and t2 and got t3 ,than we can compare t1[key] , t3[key] and t3[key:key]
- I think we expect t3[key] just work like t1[key],but t3[key] work same as t3[key:key]
- it makes people confused extremely, in fact,I cost hours for that
Expected Output
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.6.final.0
python-bits: 64
OS: Darwin
OS-release: 17.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.23.4
pytest: None
pip: 18.1
setuptools: 36.4.0
Cython: None
numpy: 1.12.1
scipy: 0.19.1
pyarrow: None
xarray: None
IPython: 7.1.1
sphinx: None
patsy: 0.5.1
dateutil: 2.7.5
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 3.0.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None