ENH: Adding new pandas option for integer formatting, Issue#57177
State: closed

- [ ] closes #57177  (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Modified the _IntArrayFormatter class and added a new display option to format integers with a delimiter in DataFrames. The default value for the delimiter is '' and user have the option of using ',' or '_' for integer separator. Note this change does not affect float or complex numbers. 




Labels:
name: Output-Formatting
description: __repr__ of pandas objects, to_string

Comments:
@Dr-Irv Any idea why I am getting this precommit error? I ran "pre-commit run --hook-stage manual --all-files" locally with no errors but I am getting one when I push my changes. 

<img width="601" alt="image" src="https://github.com/pandas-dev/pandas/assets/70726252/befffcb5-c887-471e-abb5-9d8ce79b9c0d">

> @Dr-Irv Any idea why I am getting this precommit error? I ran "pre-commit run --hook-stage manual --all-files" locally with no errors but I am getting one when I push my changes.
> 
> <img alt="image" width="601" src="https://private-user-images.githubusercontent.com/70726252/327826028-befffcb5-c887-471e-abb5-9d8ce79b9c0d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTUwMDI0MzQsIm5iZiI6MTcxNTAwMjEzNCwicGF0aCI6Ii83MDcyNjI1Mi8zMjc4MjYwMjgtYmVmZmZjYjUtYzg4Ny00NzFlLWFiYjUtOWQ4Y2U3OWI5YzBkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTA2VDEzMjg1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTIxNTYxNzE1ZjYxZjUyNDI5MWY3MWNlZWIwMGFiMGY3YmZhYzkwZjRkNWQxMmUxMWMwYzA5Njg1NmY3MDQ4NDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.fot0Pa92TSu0rdiNYlGuyPURxfECSE2rtrNDLRsi0Ko">

If you look at the output of the CI check here (https://results.pre-commit.ci/run/github/858127/1714714926.f5LU8a9SRWKOAlR2F43xpQ), that will indicate the issue.  I'm not sure if the pre-commit checks run locally are the same as run in CI.

@Dr-Irv Forgot to mention that I looked at that which lead me to post the comment. Just could not figure out what this error meant. Tried to see if this ruff-format ran locally so that I could commit the file that was reformatted, but it did not happen. 

<img width="1050" alt="image" src="https://github.com/pandas-dev/pandas/assets/70726252/c10b2023-44cc-4d6a-bc20-07e4eb9ac654">

> @Dr-Irv Forgot to mention that I looked at that which lead me to post the comment. Just could not figure out what this error meant. Tried to see if this ruff-format ran locally so that I could commit the file that was reformatted, but it did not happen.
> 
> <img alt="image" width="1050" src="https://private-user-images.githubusercontent.com/70726252/328207899-c10b2023-44cc-4d6a-bc20-07e4eb9ac654.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTUwMDc2NDYsIm5iZiI6MTcxNTAwNzM0NiwicGF0aCI6Ii83MDcyNjI1Mi8zMjgyMDc4OTktYzEwYjIwMjMtNDRjYy00ZDZhLWJjMjAtMDdlNGViOWFjNjU0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTA2VDE0NTU0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ1ZDQ4ODIyZGUyMDBiNjBjMTE0YWZkNDcyNzkyNzBmNzAzYjAyYjcyZTMxZjhhM2M2NGFlYzIyMzdkZGY2YWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.0PEoPl8LZG5KhA1EHmMQf-MUtQcd39z9CZgMSO4RWDU">

Make sure you do the following:
1) Merge with `upstream/main`
2) Update your environment, e.g., `mamba env update --file environment.yml `
3) Update the pre-commit hooks:  `pre-commit install`

I did this, edited a file that I knew would get fixed by `ruff-format`, and it was invoked when committing that file.

Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.