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

col_space parameter in to_html and to_string for dataframe #1000

Closed
tejrai opened this issue Apr 5, 2012 · 2 comments · Fixed by #2328
Closed

col_space parameter in to_html and to_string for dataframe #1000

tejrai opened this issue Apr 5, 2012 · 2 comments · Fixed by #2328
Labels
Milestone

Comments

@tejrai
Copy link

tejrai commented Apr 5, 2012

The col_space parameter in the to_html and to_string functions for dataframe doesn't seem to affect the output. Here's an example using to_html(). Note that the HTML code is identical across the two function calls.

Thanks,
Tej

output.to_html()

nearby = 1 nearby = 2
CM_CL K2 M2
FI_TY M2 NaN

output.to_html(col_space = 2000)

nearby = 1 nearby = 2
CM_CL K2 M2
FI_TY M2 NaN
@vincentarelbundock
Copy link

I can confirm that this bug also affects to_string(). Using pandas 0.8.1 I get this:

In [1]: import numpy as np

In [2]: import pandas as pd

In [3]: df = pd.DataFrame(np.random.random(size=(3,3)))

In [4]: print df.to_string(col_space=2)
          0         1         2
0  0.972671  0.735920  0.186650
1  0.092195  0.544714  0.750312
2  0.534684  0.685200  0.887377

In [5]: print df.to_string(col_space=5)
          0         1         2
0  0.972671  0.735920  0.186650
1  0.092195  0.544714  0.750312
2  0.534684  0.685200  0.887377

In [6]: print df.to_string(col_space=10)
          0         1         2
0  0.972671  0.735920  0.186650
1  0.092195  0.544714  0.750312
2  0.534684  0.685200  0.887377

wesm added a commit that referenced this issue Nov 29, 2012
* y-p/fix_col_space:
  DOC: change definition of col_space.
  BUG: df.to_html() should respect col_space argument. #1000
  TST: df.to_html() should respect col_space argument
  BUG: df.to_string() should respect self.col_space, #1000
  TST: df.to_string() should respect self.col_space
@wesm wesm closed this as completed Nov 29, 2012
@questglobal-bom
Copy link

Is it possible to set col_space for a specific column only?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants