Closed
Description
Code Sample, a copy-pastable example if possible
import numpy as np
import pandas as pd
print(
pd.Series([1., 2.2222, np.inf]).round(1)
)
Problem description
The display of floating precision in a dataframe and serie could be improved in the presence of np.inf
.
My expectation would be that np.inf
would induce the same behavior than 'NaN
.
Expected Output
0 1.0
1 2.2
2 inf
dtype: float64
Instead, the following result is obtained:
0 1.000000
1 2.200000
2 inf
dtype: float64
Note that this is the result in presence of a NaN
:
0 1.0
1 2.2
2 NaN
dtype: float64
Output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.7.final.0
python-bits: 64
OS: Linux
OS-release: 4.15.0-43-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.23.4
pytest: None
pip: 10.0.1
setuptools: 39.2.0
Cython: None
numpy: 1.14.5
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.4.0
sphinx: None
patsy: 0.5.0
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 3.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None