Skip to content

printing out pandas series takes ages #3082

Closed
@Strateus

Description

@Strateus

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions