Skip to content

COMPAT/BLD: int dtype in json tests #14100

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

Merged
merged 1 commit into from
Aug 28, 2016
Merged

Conversation

chris-b1
Copy link
Contributor

@jreback
Copy link
Contributor

jreback commented Aug 27, 2016

so maybe add a note in json docs that deserializstion will go to platform ints

@chris-b1
Copy link
Contributor Author

chris-b1 commented Aug 27, 2016

The public json api (pd.read_json) actually coerces everything to int64, it's only the internal methods where you can get a platform int.

In [45]: s = pd.Series([1,2,3])

In [46]: pd.read_json(s.to_json(orient='records'), typ='series').dtype
Out[46]: dtype('int64')

In [47]: from pandas.json import loads

In [48]: loads(s.to_json(orient='records'), numpy=True).dtype
Out[48]: dtype('int32')

edit: one more example., just to confirm numpy=True also coerces

In [53]: pd.read_json(s.to_json(orient='records'), 
              typ='series', numpy=True, orient='records').dtype
Out[53]: dtype('int64')

@jreback
Copy link
Contributor

jreback commented Aug 27, 2016

ok thanks @chris-b1 ping on green.

@jreback jreback added Windows Windows OS Compat pandas objects compatability with Numpy or Python functions labels Aug 27, 2016
@jreback jreback added this to the 0.19.0 milestone Aug 27, 2016
@codecov-io
Copy link

codecov-io commented Aug 27, 2016

Current coverage is 85.26% (diff: 100%)

Merging #14100 into master will not change coverage

@@             master     #14100   diff @@
==========================================
  Files           139        139          
  Lines         50502      50502          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          43063      43063          
  Misses         7439       7439          
  Partials          0          0          

Powered by Codecov. Last update a0151a7...a2825d9

@jreback jreback merged commit 8d1646c into pandas-dev:master Aug 28, 2016
@jreback
Copy link
Contributor

jreback commented Aug 28, 2016

thank you sir!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions Windows Windows OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants