Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
python --version
Python 3.8.0
---------------------
import pandas as pd
idx = pd.date_range(start='2021-01-01 12:00', end='2021-01-10 12:00', periods=10)
s = pd.Series(name='test', index=idx, dtype=bool)
pd.__version__
Out: '1.3.5'
s
Out:
2021-01-01 12:00:00 False
2021-01-02 12:00:00 False
2021-01-03 12:00:00 False
2021-01-04 12:00:00 False
2021-01-05 12:00:00 False
2021-01-06 12:00:00 False
2021-01-07 12:00:00 False
2021-01-08 12:00:00 False
2021-01-09 12:00:00 False
2021-01-10 12:00:00 False
Name: test, dtype: bool
after updating pandas and creating the same Series --->
pd.__version__
Out: '1.4.0'
s
Out:
2021-01-01 12:00:00 True
2021-01-02 12:00:00 True
2021-01-03 12:00:00 True
2021-01-04 12:00:00 True
2021-01-05 12:00:00 True
2021-01-06 12:00:00 True
2021-01-07 12:00:00 True
2021-01-08 12:00:00 True
2021-01-09 12:00:00 True
2021-01-10 12:00:00 True
Name: test, dtype: bool
Issue Description
In pandas v. 1.3.5 the default data values for a series with dtype=bool is False. In pandas v. 1.4.0 it is True. I identified the cause after some of my automatic tests failed.
Expected Behavior
Expected default data values to be False for a series created with only index and dtype=bool specified.
Or at least consistent between versions.
Installed Versions
pd.show_versions()
INSTALLED VERSIONS
commit : bb1f651
python : 3.8.0.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : Norwegian Bokmål_Norway.1252
pandas : 1.4.0
numpy : 1.22.2
pytz : 2021.3
dateutil : 2.8.2
pip : 22.0.3
setuptools : 41.2.0
Cython : None
pytest : 7.0.0
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 8.0.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.5.1
numba : None
numexpr : 2.8.1
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.8.0
sqlalchemy : 1.4.31
tables : 3.7.0
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None