Skip to content

ENH: formatting integers in FloatIndex as floats #12207

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

Closed
wants to merge 1 commit into from
Closed

ENH: formatting integers in FloatIndex as floats #12207

wants to merge 1 commit into from

Conversation

nbonnotte
Copy link
Contributor

Ref issue #12164

Previous Behavior:

   In [2]: s = Series([1,2,3], index=np.arange(3.))

   In [3]: s
   Out[3]:
   0    1
   1    2
   2    3
   dtype: int64

   In [4]: s.index
   Out[4]: Float64Index([0.0, 1.0, 2.0], dtype='float64')

   In [5]: print(s.to_csv(path=None))
   0,1
   1,2
   2,3

New behavior

   In [2]: s = Series([1,2,3], index=np.arange(3.))

   In [3]: s
   Out[3]:
   0.0    1
   1.0    2
   2.0    3
   dtype: int64


   In [4]: s.index
   Out[4]: Float64Index([0.0, 1.0, 2.0], dtype='float64')

   In [5]: print(s.to_csv(path=None))
   0.0,1
   1.0,2
   2.0,3

@jreback
Copy link
Contributor

jreback commented Feb 2, 2016

did this break anything non-trivial?

@jreback jreback added the Output-Formatting __repr__ of pandas objects, to_string label Feb 2, 2016
@jreback jreback added this to the 0.18.0 milestone Feb 2, 2016
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Integers in `FloatIndex` (e.g. 1.) are now formatted with a decimal point
and a `0` digit (e.g. `1.0`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the issue number

@jreback jreback added the Clean label Feb 2, 2016
@nbonnotte
Copy link
Contributor Author

Tests fails with Python 3.5 because I'm an idiot. I'll fix that tomorrow (the test failure I mean, because me being an idiot will take more time to be fixed)

Otherwise, no, it doesn't seem to have broken anything non-trivial.

@nbonnotte
Copy link
Contributor Author

@jreback all green

@jreback jreback closed this in 6693a72 Feb 5, 2016
@nbonnotte nbonnotte deleted the trim-zero-too-much branch February 6, 2016 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants