Description
Here's something I noticed while working on #30277
Code Sample, a copy-pastable example if possible
import pandas as pd
import numpy as np
import pytz
temp_1 = pd.Series([pd.Timestamp("2019-07-19 07:04:57")])
temp_2 = pd.Series([pd.Timestamp("2019-07-19 07:04:57+0100", tz=pytz.FixedOffset(60))])
data = np.array([["2019-06-19 07:04:57"]])
pd.DataFrame(data, dtype=temp_1.dtype) # works
pd.DataFrame(data, dtype=temp_2.dtype) # fails
Problem description
The example that fails throws the error:
ValueError: If using all scalar values, you must pass an index
If I pass an index:
pd.DataFrame(data, dtype=temp_2.dtype, index=[0]) # fails
then it fails with
ValueError: Buffer has wrong number of dimensions (expected 1, got 2)
although this doesn't:
pd.DataFrame(data, dtype=temp_1.dtype, index=[0]) # works
Expected Output
I wouldn't expect this behaviour to change based on the dtype
passed.
Output of pd.show_versions()
/home/SERILOCAL/m.gorelli/pandas/pandas/core/index.py:29: FutureWarning: pandas.core.index is deprecated and will be removed in a future version. The public classes are available in the top-level namespace.
FutureWarning,
INSTALLED VERSIONS
commit : 3577b5a
python : 3.7.3.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-72-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8
pandas : 0.25.0+1383.g3577b5a34
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.0
pip : 19.3.1
setuptools : 42.0.2.post20191201
Cython : 0.29.14
pytest : 5.3.2
hypothesis : 4.55.4
sphinx : 2.3.0
blosc : None
feather : None
xlsxwriter : 1.2.6
lxml.etree : 4.4.2
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.9.0
pandas_datareader: None
bs4 : 4.8.1
bottleneck : 1.3.1
fastparquet : 0.3.2
gcsfs : None
lxml.etree : 4.4.2
matplotlib : 3.1.2
numexpr : 2.7.0
odfpy : None
openpyxl : 3.0.1
pandas_gbq : None
pyarrow : 0.15.1
pytables : None
pytest : 5.3.2
s3fs : 0.4.0
scipy : 1.4.0
sqlalchemy : 1.3.11
tables : 3.6.1
xarray : 0.14.1
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.2.6