<commit_before>import numpy as np
import pandas as pd
import pandas.compat as compat


class TablePlotter(object):
    """
    Layout some DataFrames in vertical/horizontal layout for explanation.
    Used in merging.rst
    """

    def __init__(self, cell_width=0.37, cell_height=0.25, font_size=7.5):
        self.cell_width = cell_width
        self.cell_height = cell_height
        self.font_size = font_size

    def _shape(self, df):
        """Calcurate table chape considering index levels"""
        row, col = df.shape
        return row + df.columns.nlevels, col + df.index.nlevels

    def _get_cells(self, left, right, vertical):
        """Calcurate appropriate figure size based on left and right data"""
        if vertical:
            # calcurate required number of cells
            vcells = max(sum([self._shape(l)[0] for l in left]),
                         self._shape(right)[0])
            hcells = (max([self._shape(l)[1] for l in left]) +
                      self._shape(right)[1])
        else:
            vcells = max([self._shape(l)[0] for l in left] +
                         [self._shape(right)[0]])
            hcells = sum([self._shape(l)[1] for l in left] +
                         [self._shape(right)[1]])
        return hcells, vcells

    def plot(self, left, right, labels=None, vertical=True):
        """
        Plot left / right DataFrames in specified layout.

        Parameters
        ----------<commit_msg>MAINT: calcurate --> calculate in _doctools.py<commit_after>import numpy as np
import pandas as pd
import pandas.compat as compat


class TablePlotter(object):
    """
    Layout some DataFrames in vertical/horizontal layout for explanation.
    Used in merging.rst
    """

    def __init__(self, cell_width=0.37, cell_height=0.25, font_size=7.5):
        self.cell_width = cell_width
        self.cell_height = cell_height
        self.font_size = font_size

    def _shape(self, df):
        """
        Calculate table chape considering index levels.
        """

        row, col = df.shape
        return row + df.columns.nlevels, col + df.index.nlevels

    def _get_cells(self, left, right, vertical):
        """
        Calculate appropriate figure size based on left and right data.
        """

        if vertical:
            # calcurate required number of cells
            vcells = max(sum([self._shape(l)[0] for l in left]),
                         self._shape(right)[0])
            hcells = (max([self._shape(l)[1] for l in left]) +
                      self._shape(right)[1])
        else:
            vcells = max([self._shape(l)[0] for l in left] +
                         [self._shape(right)[0]])
            hcells = sum([self._shape(l)[1] for l in left] +
                         [self._shape(right)[1]])
        return hcells, vcells

    def plot(self, left, right, labels=None, vertical=True):
        """
        Plot left / right DataFrames in specified layout.

        Parameters
        ----------
{'fraction_non_alphanumeric': 0.11318864774624374, 'fraction_numerical': 0.010684474123539232, 'mean_word_length': 1.9575518262586378, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6578863', 'n_tokens_mistral': 889, 'n_tokens_neox': 832, 'n_words': 246}