We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
import pandas as pd import numpy as np rows=5 cols=2 index = pd.Index(range(rows), name='MYINDEX') columns = pd.Index(range(cols), name='MYCOLUMNS') df = pd.DataFrame(np.random.rand(rows,cols), index=index, columns=columns) df Out[2]: MYCOLUMNS 0 1 MYINDEX 0 0.163862 0.828853 1 0.560261 0.980514 2 0.736242 0.055051 3 0.825197 0.783094 4 0.153369 0.069713 df.round(2) Out[3]: 0 1 MYINDEX 0 0.16 0.83 1 0.56 0.98 2 0.74 0.06 3 0.83 0.78 4 0.15 0.07 np.round(df, 2) Out[4]: 0 1 MYINDEX 0 0.16 0.83 1 0.56 0.98 2 0.74 0.06 3 0.83 0.78 4 0.15 0.07 np.floor(df) Out[5]: MYCOLUMNS 0 1 MYINDEX 0 0 0 1 0 0 2 0 0 3 0 0 4 0 0 pd.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.5.1.final.0 python-bits: 64 OS: Linux OS-release: 2.6.32-431.11.2.el6.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 pandas: 0.17.1 nose: 1.3.7 pip: 7.1.2 setuptools: 19.1.1 Cython: 0.23.4 numpy: 1.10.2 scipy: 0.16.1 statsmodels: None IPython: 4.0.1 sphinx: 1.3.1 patsy: 0.4.0 dateutil: 2.4.2 pytz: 2015.7 blosc: None bottleneck: 1.0.0 tables: 3.2.2 numexpr: 2.4.4 matplotlib: 1.5.0 openpyxl: 2.2.6 xlrd: 0.9.4 xlwt: 1.0.0 xlsxwriter: 0.7.7 lxml: 3.5.0 bs4: 4.4.1 html5lib: None httplib2: None apiclient: None sqlalchemy: 1.0.10 pymysql: None psycopg2: None Jinja2: None
The text was updated successfully, but these errors were encountered:
so it does. pull-requests are welcome!
Sorry, something went wrong.
BUG: DataFrame.round() drops column index name, #11986
9b5c052
closed by 9b5c052
thanks!
Successfully merging a pull request may close this issue.
The text was updated successfully, but these errors were encountered: