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 · 1 comment · Fixed by #2328

Comments

@tejrai
Copy link

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

This comment has been minimized.

Copy link
Contributor

commented Aug 4, 2012

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
Merge remote branch 'y-p/fix_col_space'
* 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 Nov 29, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.