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

Wrong number of row in to_latex output for MultiIndex Dataframe #9778

Closed
frubino opened this issue Apr 1, 2015 · 4 comments
Closed

Wrong number of row in to_latex output for MultiIndex Dataframe #9778

frubino opened this issue Apr 1, 2015 · 4 comments
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string
Milestone

Comments

@frubino
Copy link

frubino commented Apr 1, 2015

If I try to run this code:

pd.DataFrame.from_dict({
    ('c1', 0): pd.Series({x: x for x in range(4)}),
    ('c1', 1): pd.Series({x: x+4 for x in range(4)}),    
    ('c2', 0): pd.Series({x: x for x in range(4)}),
    ('c2', 1): pd.Series({x: x+4 for x in range(4)}),
    ('c3', 0): pd.Series({x: x for x in range(4)}),
}).T.to_latex()

The result is 2 rows instead of 5 in the latex output. If I use a csv it works.

I'm running pandas 0.16.0 under python 2.7 on Mac OS X 10.10

@jreback
Copy link
Contributor

jreback commented Apr 2, 2015

will mark as a bug. mi index handling was added in #7982.

@jreback jreback added Bug Output-Formatting __repr__ of pandas objects, to_string Good as first PR labels Apr 2, 2015
@jreback jreback added this to the Next Major Release milestone Apr 2, 2015
@JohnSmizz
Copy link

Odd thing is it worked fine in last pandas I was using, it just stopped working properly in most recent update. My MI is in the rows, and the LaTeX output seems very confused -- some rows omitted and the data for the row is not correct either -- check eg results to this example call on pd 0.15.2

index = pd.MultiIndex.from_product([np.arange(2), np.arange(2)])
df = pd.DataFrame(index=index, data=np.random.rand(4,2))

df.head() <> df.to_latex() for both multiindex as well as the actual data...

@shoyer
Copy link
Member

shoyer commented Apr 16, 2015

Fixed by #9908

@shoyer shoyer closed this as completed Apr 16, 2015
@frubino
Copy link
Author

frubino commented Apr 16, 2015

Thanks

@jreback jreback modified the milestones: 0.16.1, Next Major Release Jul 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

No branches or pull requests

4 participants