-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
to_json
of Series with period dtype results in AttributeError
#31917
Comments
Yea just don't think this is implemented in the serializer. Would take a PR to support |
@WillAyd would this go through values_for_json? I just started a branch that moves values_for_json from the Block to the EA, want to see if doing so fixes any existing issues and this seems like a candidate. |
Been a while since I looked at it but I think the datetimes still return primitive values in A more robust/challenging approach would be to implement similar period serialization functions in the |
in #53680 i tried implementing PeriodArray._values_for_json to return
i'm guessing that the |
I don't know the JSON table specification that deeply so hard to say if that is correct or not without reading through the spec. The other consideration point is how to get that to work with existing JSON keywords like date_format and date_unit |
oh if there is a table spec then do we want to explicit not-support dtypes that are not part of the spec? That would be better than the current |
The table spec is located at https://specs.frictionlessdata.io/table-schema/ (pulled link from the top of the _table_schema.py module) I think we already extend it for timezone support, though I'm not sure if the way we extended that was part of the spec or something we invented. The table format is different than the other formats and follows quite a few different paths in the code base. |
Code Sample, a copy-pastable example if possible
Leads to:
This issue also crops up in dataframes where a column is a period Series and
orient='table'
.Problem description
I can't find anything that says this would be unsupported.
Expected Output
Json string of series representation.
Output of
pd.show_versions()
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.6.final.0
python-bits : 64
OS : Darwin
OS-release : 18.7.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.1
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.2.0.post20200210
Cython : None
pytest : 5.3.5
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.12.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : 5.3.5
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: