Generate internal documentation of functions and attributes in Python Modules

1 min read

Nobody can memorize and remember all the functions offered by Python in its numerous modules. That’s why while coding in Python we always refer to in google and read the documentation. But what if there was no google? Can we retrive the internal documentations that come with Python by default? Yes, we can do it. I’ve written the following function to generate internal documentation table of any python module. This function requires pandas package. If it’s not installed in your system please use pip install pandas to install it.

import pandas as pd
pd.set_option('display.max_rows', 500)

def get_default_documentation(modl):
  documentation_dict = dict(
                                [i for i in dir(modl)], 
                                    ['function' if callable(getattr(modl, i)) else 'attribute' for i in dir(modl)],
                                    [getattr(modl, i).__doc__ for i in dir(modl)],
  documentation = pd.DataFrame(documentation_dict)\
                              .rename(columns={0:'type', 1:'documentation'})\

  documentation =**{'text-align': 'left'})
  return documentation

Now you can call the get_default_documentation and pass the module name for which you want to generate the internal documentation table.

For Example:


You can get the full list of Python Libraries from this link: This function will also work on thrid-party libraries.