-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: DataFrame created with tzinfo cannot use to_dict(orient="records") #18372
Comments
yeah this looks buggy. a PR to fix would be great! |
If you can give me some hints where to look that would be appreciated. I ‘hacked’ the code in core/frame.py to check for iterable, but I don’t think that is really the fix (or is it?). |
see also https://github.com/pandas-dev/pandas/pull/18167/files
The issue is that a single column of datetimetz returns a 1-d array (rather than a 2-d array) when using |
xref #13407 |
Thx! I’ll have a look (to add tests) - or are you applying this patch yourself? |
nope love for a PR (test and whatsnew note) |
Will do. I will need to change your code slightly as it is not the proper fix, but it put me on the right path |
A bug in to_dict(orient="records") in pandas/core/frame.py prevents datetimes with time zones to be worked with. This works around the issue in superset by re-implementing the logic of pandas in the correct way. Until pandas fixes the issue this code should stay. pandas-dev/pandas#18372 This closes apache#1929
A bug in to_dict(orient="records") in pandas/core/frame.py prevents datetimes with time zones to be worked with. This works around the issue in superset by re-implementing the logic of pandas in the correct way. Until pandas fixes the issue this code should stay. pandas-dev/pandas#18372 This closes #1929
…cords") Columns with datetimez are not returning arrays. Closes pandas-dev#18372
…cords") Columns with datetimez are not returning arrays. Closes pandas-dev#18372
…cords") Columns with datetimez are not returning arrays. Closes pandas-dev#18372
…cords") Columns with datetimez are not returning arrays. Closes pandas-dev#18372
…cords") Columns with datetimez are not returning arrays. Closes pandas-dev#18372
…cords") Columns with datetimez are not returning arrays. Closes pandas-dev#18372
…cords") (pandas-dev#18416) Closes pandas-dev#18372 (cherry picked from commit 4e09480)
A bug in to_dict(orient="records") in pandas/core/frame.py prevents datetimes with time zones to be worked with. This works around the issue in superset by re-implementing the logic of pandas in the correct way. Until pandas fixes the issue this code should stay. pandas-dev/pandas#18372 This closes apache#1929
A bug in to_dict(orient="records") in pandas/core/frame.py prevents datetimes with time zones to be worked with. This works around the issue in superset by re-implementing the logic of pandas in the correct way. Until pandas fixes the issue this code should stay. pandas-dev/pandas#18372 This closes apache#1929
Code Sample, a copy-pastable example if possible
Problem description
The above code fails in pandas 0.21.0 with
Expected Output
Dict of records
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit: None
python: 2.7.13.final.0
python-bits: 64
OS: Darwin
OS-release: 17.2.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.21.0
pytest: 3.2.1
pip: 9.0.1
setuptools: 36.6.0
Cython: None
numpy: 1.13.3
scipy: None
pyarrow: None
xarray: None
IPython: 5.5.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0b10
sqlalchemy: 1.1.4
pymysql: None
psycopg2: 2.7.1 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: