Pandas ellipsis dots may confuse repl
#2
Unanswered
EpigeneMax
asked this question in
Q&A
Replies: 1 comment
-
That's a good tip. I can make use of it in Jupyter as well. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When displaying a large dataframe,
pandas
skips the middle part of the frame and figures the skip using ellipsis dots "...".REPL can interpret them as an unfinished input prompt line, causing a shift in the output lines.
.. repl:: import numpy as np import pandas as pd df = pd.DataFrame({"foo": np.arange(1000)}) df.index = [f"longrowname{i}" for i in np.arange(1000)] df # the ellipsis dots occur here... print("Hello, world!") # ...and cause a shift from here on print("nothing")
results in
The workaround it to use
df.head()
when displaying large dataframes, or to make sure to disable ellipsis.Beta Was this translation helpful? Give feedback.
All reactions