Skip to content
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

Make IntArrayFormatter and all upstream users able to specify formatting for integer types #3096

Closed
blais opened this issue Mar 19, 2013 · 3 comments

Comments

@blais
Copy link
Contributor

blais commented Mar 19, 2013

This was found while attempting to add thousand separators (commas) on a Series.to_string() call. It looks like you can specify the format for floats, but not for integers.

It's impossible right now. I could transform the Series instance into a FP representation, but that is the wrong thing to do.

@ghost
Copy link

ghost commented Mar 19, 2013

Yes, float_format isn't as general as it ought to be, and only supports
old % style formatting.

For now, maybe just:

s=pd.Series(range(1000,1025))
pd.Series(map(lambda x: "{:,}".format(x),s.values))
Out[11]: 
0     1,000
1     1,001
2     1,002
3     1,003
4     1,004
5     1,005
6     1,006
7     1,007
8     1,008
9     1,009
10    1,010
11    1,011
12    1,012
13    1,013
14    1,014
15    1,015
16    1,016
17    1,017
18    1,018
19    1,019
20    1,020
21    1,021
22    1,022
23    1,023
24    1,024
dtype: object

@ghost
Copy link

ghost commented Mar 19, 2013

related #2502

@hayd
Copy link
Contributor

hayd commented May 29, 2014

closing in favor of master issue #4668

@hayd hayd closed this as completed May 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants