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

BUG: Issue with to_latex and MultiIndex column format. GH8336 #8784

Closed
wants to merge 21 commits into from

Conversation

kotfic
Copy link

@kotfic kotfic commented Nov 11, 2014

closes #8336

This is a potential resolution to GH8336 It borrows the same code flow from _get_formatted_index in
pandas.core.format

import pandas as pd
pd.show_versions()

df = pd.DataFrame({
    "A": [191, 191, 193, 193, 193],
    "B": [1, 1, 2, 2, 3],
    "C": ["foo", "foo", "foo", "foo", "foo"],
    "D": ["bar", "bar", "bar", "bar", "bar"]})

print "\nOutput:"
print df.set_index(["A", "B"]).to_latex()
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.8.final.0
python-bits: 64
OS: Linux
OS-release: 3.17.2-1-ARCH
machine: x86_64
processor: 
byteorder: little
LC_ALL: None
LANG: C

pandas: 0.15.1
nose: 1.3.4
Cython: 0.21.1
numpy: 1.9.1
scipy: 0.14.0
statsmodels: 0.6.0
IPython: 2.3.0
sphinx: 1.2.3
patsy: 0.3.0
dateutil: 2.2
pytz: 2014.9
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.4.0
openpyxl: 2.1.1
xlrd: 0.9.3
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.3.2
html5lib: None
httplib2: 0.9
apiclient: None
rpy2: None
sqlalchemy: 0.9.8
pymysql: None
psycopg2: None

Output:
\begin{tabular}{llll}
\toprule
    &   &    C &    D \\
\midrule
191 & 1 &      &      \\
193 & 2 &  foo &  bar \\
\bottomrule
\end{tabular}

After PR

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.8.final.0
python-bits: 64
OS: Linux
OS-release: 3.17.2-1-ARCH
machine: x86_64
processor: 
byteorder: little
LC_ALL: None
LANG: C

pandas: 0.15.1-18-g81c8a5f
nose: None
Cython: None
numpy: 1.9.1
scipy: None
statsmodels: None
IPython: 2.3.0
sphinx: None
patsy: None
dateutil: 2.2
pytz: 2014.9
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
rpy2: None
sqlalchemy: None
pymysql: None
psycopg2: None

Output:
\begin{tabular}{llll}
\toprule
    &   &    C &    D \\
\midrule
191 & 1 &      &      \\
    & 1 &  foo &  bar \\
193 & 2 &  foo &  bar \\
    & 2 &  foo &  bar \\
    & 3 &  foo &  bar \\
\bottomrule
\end{tabular}

This is a potential resolution to
pandas-dev#8336
It borrows the same code flow from _get_formatted_index in
pandas.core.format
@kotfic
Copy link
Author

kotfic commented Nov 11, 2014

This is my first PR on this project, please let me know if there are format issues, or other things I need to do. I've looked through CONTRIBUTING.md and done my best.

Cheers!

@rockg
Copy link
Contributor

rockg commented Nov 11, 2014

The first thing somebody will tell you is that you need to add some tests for your change.

@jreback
Copy link
Contributor

jreback commented Nov 11, 2014

@kotfic also, pls post a before and after rendered version of this

@jreback jreback added MultiIndex Output-Formatting __repr__ of pandas objects, to_string labels Nov 11, 2014
@kotfic
Copy link
Author

kotfic commented Nov 11, 2014

Thanks for the feedback, I know it can be a pain bringing up new contributors.

tmp

I'll fix the test later this evening!
Thanks!
/Chris

dsm054 and others added 15 commits March 22, 2015 14:40
Now we use Series.str this is not in the submodule anymore
DOC: add automatic content to 0.16.1 whatsnew file
…ismatch

BUG: ensure we use group sizes, not group counts, in transform (GH9697)
DOC: try to use matplotlib style (mpl >= 1.4) in all docs
DOC: add DataFrame.assign to API docs
Changes to be committed:
	modified:   pandas/core/series.py
	modified:   pandas/tests/test_series.py

Fixes global reference to iNaT (should be tslib.iNaT) in series._maybe_box.
Adds test `test_datetime_timedelta_quantiles` to check for proper return value
in test_series.py.

Issue pandas-dev#9675
@jreback
Copy link
Contributor

jreback commented Mar 25, 2015

@kotfic can you rebase this and we can get this in.

jreback and others added 4 commits March 26, 2015 05:49
…quarters

ENH Make year and quarter dash-separatable
This is a potential resolution to
pandas-dev#8336
It borrows the same code flow from _get_formatted_index in
pandas.core.format
@kotfic
Copy link
Author

kotfic commented Mar 26, 2015

@jreback Hi, sorry I lost track of this, I have rebased, is there something I need to do to update the pull-request?

@jorisvandenbossche
Copy link
Member

@kotfic First, can you try to rebase again? As something went wrong there, making it very difficult to review.

Normally you can just do:

git fetch upstream
git rebase upstream/master
git push -f

and it should be OK.

@jorisvandenbossche
Copy link
Member

Secondly, some other needed updates:

  • Can you add a test for this?
  • Can you add a small release note in doc/source/whatsnew/v0.16.1.txt?

If you need any help, just ask here! (or at https://gitter.im/pydata/pandas)

cc @hayd

@jorisvandenbossche jorisvandenbossche added this to the 0.16.1 milestone Apr 17, 2015
@jreback
Copy link
Contributor

jreback commented Apr 29, 2015

@kotfic can you rebase on master, and squash your commits,
see here for help

@jreback jreback modified the milestones: 0.17.0, 0.16.1 Apr 29, 2015
@jreback
Copy link
Contributor

jreback commented Jul 28, 2015

closing as stale, but if you would like to reopen and fixup pls do.

@jreback jreback closed this Jul 28, 2015
@jorisvandenbossche jorisvandenbossche modified the milestones: No action, 0.17.0 Jul 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MultiIndex Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

to_latex with MI column and index names
9 participants