1

I recently started using python. And, I am trying to get the report using pandas_profiling, I am running into IndexError. Can someone please explain how I can debug this?

Data has like 30 variables and some 800,000 rows.

So far I am trying to read a csv file into data frame and profile it using pandas profiling. No custom code is written a[part from consuming standard libraries and packages.

Thanks in advance

import numpy as np
import pandas as pd
from pandas_profiling import ProfileReport
df_s = pd.read_csv(r'<file_path>')
ProfileReport(df_s)

Error below




---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
~\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas_profiling\__init__.py in _repr_html_(self)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas_profiling\__init__.py in to_widgets(self)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas_profiling\report\presentation\flavours\widget\sequence.py in render(self)
     95 
     96         elif self.sequence_type in ["tabs", "sections"]:
---> 97             widget = get_tabs(self.content["items"])
     98         elif self.sequence_type == "accordion":
     99             widget = get_accordion(self.content["items"])

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas_profiling\report\presentation\flavours\widget\sequence.py in get_tabs(items)
     16     titles = []
     17     for item in items:
---> 18         children.append(item.render())
     19         titles.append(get_name(item))
     20 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas_profiling\report\presentation\flavours\widget\sequence.py in render(self)
     97             widget = get_tabs(self.content["items"])
     98         elif self.sequence_type == "accordion":
---> 99             widget = get_accordion(self.content["items"])
    100         elif self.sequence_type == "grid":
    101             widget = get_row(self.content["items"])

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas_profiling\report\presentation\flavours\widget\sequence.py in get_accordion(items)
     59     titles = []
     60     for item in items:
---> 61         children.append(item.render())
     62         titles.append(get_name(item))
     63 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas_profiling\report\presentation\flavours\widget\preview.py in render(self)
      9         else:
     10             items = [self.content["top"]]
---> 11         return WidgetSequence(items, sequence_type="variable").render()

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas_profiling\report\presentation\flavours\widget\sequence.py in render(self)
     75         elif self.sequence_type == "variable":
     76             i1 = self.content["items"][0].render()
---> 77             i2 = self.content["items"][1].render()
     78             toggle = widgets.ToggleButton(description="Toggle details")
     79 

IndexError: list index out of range


1 Answers1

0

I had the same error, then I reduce the num of df_s and it works. You can have a try.

example:

ProfileReport(df_s[:10000])
Abdullah Qudeer
  • 949
  • 7
  • 24
lingo
  • 1
  • 1