<commit_before>from .pandas_vb_common import *
from datetime import timedelta


class Constructors1(object):
    goal_time = 0.2

    def setup(self):
        self.data_frames = {}
        self.start = datetime(1990, 1, 1)
        self.end = datetime(2012, 1, 1)
        for x in range(100):
            self.end += timedelta(days=1)
            self.dr = np.asarray(date_range(self.start, self.end))
            self.df = DataFrame({'a': ([0] * len(self.dr)), 'b': ([1] * len(self.dr)), 'c': ([2] * len(self.dr)), }, index=self.dr)
            self.data_frames[x] = self.df

    def time_panel_from_dict_all_different_indexes(self):
        Panel.from_dict(self.data_frames)


class Constructors2(object):
    goal_time = 0.2

    def setup(self):
        self.data_frames = {}
        for x in range(100):
            self.dr = np.asarray(DatetimeIndex(start=datetime(1990, 1, 1), end=datetime(2012, 1, 1), freq='D'))
            self.df = DataFrame({'a': ([0] * len(self.dr)), 'b': ([1] * len(self.dr)), 'c': ([2] * len(self.dr)), }, index=self.dr)
            self.data_frames[x] = self.df

    def time_panel_from_dict_equiv_indexes(self):
        Panel.from_dict(self.data_frames)


class Constructors3(object):
    goal_time = 0.2

    def setup(self):
        self.dr = np.asarray(DatetimeIndex(start=datetime(1990, 1, 1), end=datetime(2012, 1, 1), freq='D'))
        self.data_frames = {}
        for x in range(100):
            self.df = DataFrame({'a': ([0] * len(self.dr)), 'b': ([1] * len(self.dr)), 'c': ([2] * len(self.dr)), }, index=self.dr)
            self.data_frames[x] = self.df

    def time_panel_from_dict_same_index(self):
        Panel.from_dict(self.data_frames)


class Constructors4(object):
    goal_time = 0.2

    def setup(self):
        self.data_frames = {}
        self.start = datetime(1990, 1, 1)
        self.end = datetime(2012, 1, 1)
        for x in range(100):
            if (x == 50):
                self.end += timedelta(days=1)
            self.dr = np.asarray(date_range(self.start, self.end))
            self.df = DataFrame({'a': ([0] * len(self.dr)), 'b': ([1] * len(self.dr)), 'c': ([2] * len(self.dr)), }, index=self.dr)
            self.data_frames[x] = self.df

    def time_panel_from_dict_two_different_indexes(self):
        Panel.from_dict(self.data_frames)<commit_msg>CLN: ASV panel ctor (#18915)<commit_after>from datetime import datetime, timedelta

from pandas import DataFrame, DatetimeIndex, date_range

from .pandas_vb_common import Panel, setup  # noqa


class DifferentIndexes(object):
    goal_time = 0.2

    def setup(self):
        self.data_frames = {}
        start = datetime(1990, 1, 1)
        end = datetime(2012, 1, 1)
        for x in range(100):
            end += timedelta(days=1)
            idx = date_range(start, end)
            df = DataFrame({'a': 0, 'b': 1, 'c': 2}, index=idx)
            self.data_frames[x] = df

    def time_from_dict(self):
        Panel.from_dict(self.data_frames)


class SameIndexes(object):

    goal_time = 0.2

    def setup(self):
        idx = DatetimeIndex(start=datetime(1990, 1, 1),
                            end=datetime(2012, 1, 1),
                            freq='D')
        df = DataFrame({'a': 0, 'b': 1, 'c': 2}, index=idx)
        self.data_frames = dict(enumerate([df] * 100))

    def time_from_dict(self):
        Panel.from_dict(self.data_frames)


class TwoIndexes(object):

    goal_time = 0.2

    def setup(self):
        start = datetime(1990, 1, 1)
        end = datetime(2012, 1, 1)
        df1 = DataFrame({'a': 0, 'b': 1, 'c': 2},
                        index=DatetimeIndex(start=start, end=end, freq='D'))
        end += timedelta(days=1)
        df2 = DataFrame({'a': 0, 'b': 1, 'c': 2},
                        index=DatetimeIndex(start=start, end=end, freq='D'))
        dfs = [df1] * 50 + [df2] * 50
        self.data_frames = dict(enumerate(dfs))

    def time_from_dict(self):
        Panel.from_dict(self.data_frames)
{'fraction_non_alphanumeric': 0.15891375408599448, 'fraction_numerical': 0.04098566758863465, 'mean_word_length': 2.444155844155844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1765849', 'n_tokens_mistral': 1531, 'n_tokens_neox': 1370, 'n_words': 291}