How to use the traittypes.DataFrame function in traittypes

To help you get started, we’ve selected a few traittypes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github power-system-simulation-toolbox / psst / psst / case / case.py View on Github external
import ipywidgets as ipyw
from collections import OrderedDict

from . import matpower
from .generator import Generator
from .bus import Bus
from .branch import Branch

logger = logging.getLogger(__name__)


class Case(t.HasTraits):

    name = t.Unicode()
    gen = tt.DataFrame()
    bus = tt.DataFrame()
    load = tt.DataFrame()
    branch = tt.DataFrame()
    bus_name = t.List(t.Unicode())
    gen_name = t.List(t.Unicode())
    branch_name = t.List(t.Unicode())
    unique_gen_names = t.Bool(default_value=True)
    _attributes = t.List(t.Unicode())

    def __init__(self, filename=None, *args, **kwargs):

        super(Case, self).__init__(*args, **kwargs)

        self.gen = pd.DataFrame(columns=list(Generator().traits().keys()))
        self.gen = self.gen.set_index('name')

        self.bus = pd.DataFrame(columns=list(Bus().traits().keys()))
github power-system-simulation-toolbox / psst / psst / case / case.py View on Github external
from collections import OrderedDict

from . import matpower
from .generator import Generator
from .bus import Bus
from .branch import Branch

logger = logging.getLogger(__name__)


class Case(t.HasTraits):

    name = t.Unicode()
    gen = tt.DataFrame()
    bus = tt.DataFrame()
    load = tt.DataFrame()
    branch = tt.DataFrame()
    bus_name = t.List(t.Unicode())
    gen_name = t.List(t.Unicode())
    branch_name = t.List(t.Unicode())
    unique_gen_names = t.Bool(default_value=True)
    _attributes = t.List(t.Unicode())

    def __init__(self, filename=None, *args, **kwargs):

        super(Case, self).__init__(*args, **kwargs)

        self.gen = pd.DataFrame(columns=list(Generator().traits().keys()))
        self.gen = self.gen.set_index('name')

        self.bus = pd.DataFrame(columns=list(Bus().traits().keys()))
        self.bus = self.bus.set_index('name')
github bloomberg / bqplot / bqplot / market_map.py View on Github external
ratio, we use the entire available space.
     - If the available space is too oblong horizontally, we use the client
       height and the width that corresponds max_aspect_ratio (maximize width
       under the constraints).
     - If the available space is too oblong vertically, we use the client width
       and the height that corresponds to min_aspect_ratio (maximize height
       under the constraint).
       This corresponds to maximizing the area under the constraints.

    Default min and max aspect ratio are both equal to 16 / 9.
    """
    names = Array([]).tag(sync=True, **array_serialization)
    groups = Array([]).tag(sync=True, **array_serialization)
    display_text = Array(None, allow_none=True)\
        .tag(sync=True, **array_serialization)
    ref_data = DataFrame(None, allow_none=True)\
        .tag(sync=True, **dataframe_serialization)\
        .valid(dataframe_warn_indexname)
    title = Unicode().tag(sync=True)

    tooltip_fields = List().tag(sync=True)
    tooltip_formats = List().tag(sync=True)
    show_groups = Bool().tag(sync=True)

    cols = Int(allow_none=True).tag(sync=True)
    rows = Int(allow_none=True).tag(sync=True)

    row_groups = Int(1).tag(sync=True)
    colors = List(CATEGORY10).tag(sync=True)
    scales = Dict().tag(sync=True, **widget_serialization)
    axes = List().tag(sync=True, **widget_serialization)
    color = Array([]).tag(sync=True, **array_serialization)
github power-system-simulation-toolbox / psst / psst / case / case.py View on Github external
import traittypes as tt
import ipywidgets as ipyw
from collections import OrderedDict

from . import matpower
from .generator import Generator
from .bus import Bus
from .branch import Branch

logger = logging.getLogger(__name__)


class Case(t.HasTraits):

    name = t.Unicode()
    gen = tt.DataFrame()
    bus = tt.DataFrame()
    load = tt.DataFrame()
    branch = tt.DataFrame()
    bus_name = t.List(t.Unicode())
    gen_name = t.List(t.Unicode())
    branch_name = t.List(t.Unicode())
    unique_gen_names = t.Bool(default_value=True)
    _attributes = t.List(t.Unicode())

    def __init__(self, filename=None, *args, **kwargs):

        super(Case, self).__init__(*args, **kwargs)

        self.gen = pd.DataFrame(columns=list(Generator().traits().keys()))
        self.gen = self.gen.set_index('name')
github power-system-simulation-toolbox / psst / psst / case / case.py View on Github external
from . import matpower
from .generator import Generator
from .bus import Bus
from .branch import Branch

logger = logging.getLogger(__name__)


class Case(t.HasTraits):

    name = t.Unicode()
    gen = tt.DataFrame()
    bus = tt.DataFrame()
    load = tt.DataFrame()
    branch = tt.DataFrame()
    bus_name = t.List(t.Unicode())
    gen_name = t.List(t.Unicode())
    branch_name = t.List(t.Unicode())
    unique_gen_names = t.Bool(default_value=True)
    _attributes = t.List(t.Unicode())

    def __init__(self, filename=None, *args, **kwargs):

        super(Case, self).__init__(*args, **kwargs)

        self.gen = pd.DataFrame(columns=list(Generator().traits().keys()))
        self.gen = self.gen.set_index('name')

        self.bus = pd.DataFrame(columns=list(Bus().traits().keys()))
        self.bus = self.bus.set_index('name')