Skip to content

printing out pandas series takes ages #3082

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

Closed
Strateus opened this issue Nov 25, 2017 · 4 comments
Closed

printing out pandas series takes ages #3082

Strateus opened this issue Nov 25, 2017 · 4 comments

Comments

@Strateus
Copy link

Notebook 5.2.1

import pandas as pd
df = pd.DataFrame(
    pd.np.random.random((10000000, 1)), 
    columns=['a'], 
    index=pd.date_range(start='2001-01-01', freq='min', periods=10000000)
)

This prints out fast:
df

But this takes ages, with full CPU load:
df.a

If i stop it, here is some traceback:

C:\Users\user\AppData\Local\conda\conda\envs\p2\lib\site-packages\IPython\core\displayhook.pyc in __call__(self, result)
    244             self.start_displayhook()
    245             self.write_output_prompt()
--> 246             format_dict, md_dict = self.compute_format_data(result)
    247             self.update_user_ns(result)
    248             self.fill_exec_result(result)

C:\Users\user\AppData\Local\conda\conda\envs\p2\lib\site-packages\IPython\core\displayhook.pyc in compute_format_data(self, result)
    148 
    149         """
--> 150         return self.shell.display_formatter.format(result)
    151 
    152     # This can be set to True by the write_output_prompt method in a subclass

C:\Users\user\AppData\Local\conda\conda\envs\p2\lib\site-packages\IPython\core\formatters.pyc in format(self, obj, include, exclude)
    146         md_dict = {}
    147 
--> 148         if self.ipython_display_formatter(obj):
    149             # object handled itself, don't proceed
    150             return {}, {}

<decorator-gen-11> in __call__(self, obj)

C:\Users\user\AppData\Local\conda\conda\envs\p2\lib\site-packages\IPython\core\formatters.pyc in catch_format_error(method, self, *args, **kwargs)
    215     """show traceback on failed format call"""
    216     try:
--> 217         r = method(self, *args, **kwargs)
    218     except NotImplementedError:
    219         # don't warn on NotImplementedErrors

C:\Users\user\AppData\Local\conda\conda\envs\p2\lib\site-packages\IPython\core\formatters.pyc in __call__(self, obj)
    911                 return True
    912             # Finally look for special method names
--> 913             method = get_real_method(obj, self.print_method)
    914             if method is not None:
    915                 method()

C:\Users\user\AppData\Local\conda\conda\envs\p2\lib\site-packages\IPython\utils\dir2.pyc in get_real_method(obj, name)
     72 
     73     try:
---> 74         m = getattr(obj, name, None)
     75     except Exception:
     76         return None
@takluyver
Copy link
Member

I think you may need to ask about this on the pandas issue tracker. We're happy to provide information about what Jupyter is doing if the pandas developers are unsure.

@Strateus
Copy link
Author

Added here: pandas-dev/pandas#18137

@TomAugspurger
Copy link

This was fixed in pandas-dev/pandas#20834 and can be closed.

@takluyver
Copy link
Member

Thanks!

@minrk minrk added this to the Reference milestone Sep 13, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants