I'm trying to make use of some parts of the Source code for statsmodels.iolib.summary2. If I try to run the source code in its entirety I'm getting the error:
ModuleNotFoundError: No module named 'main.table'; 'main' is not a package
This is raised after:
from .table import SimpleTable
From the post What does a . in an import statement in Python mean? I'm able to understand why this error is raised conceptually (at best), but I have no Idea how to work around it.
What I've tried:
From the comments we have:
[...] It basically means the current namespace or package directory
This made me think that it was imported from textwrap, but it doesn't seem that way. Since statsmodels
is often imported like import statsmodels.api as sm
i thought that it would be a similar thing with Simpletable
, so I've tried importing it in different ways and with different combinations of statsmodels and statsmodels.compat.collections since these are also used in the beginning of the source:
from statsmodels.compat.python import (lrange, iterkeys, iteritems, lzip,
reduce, itervalues, zip, string_types,
range)
from statsmodels.compat.collections import OrderedDict
import numpy as np
import pandas as pd
import datetime
import textwrap
from .table import SimpleTable
from .tableformatting import fmt_latex, fmt_txt
I've also tried to install SimpleTable (conda), but I think I'm just way off target here, so any suggestions would be great!