Пример #1
0
    def test_long(self):
        def _check(left, right):
            tm.assert_panel_equal(left.to_wide(),
                                  right.to_wide())

        wp = tm.makeWidePanel()
        self._check_roundtrip(wp.to_long(), _check)
Пример #2
0
 def test_repr(self):
     repr(self.store)
     self.store['a'] = tm.makeTimeSeries()
     self.store['b'] = tm.makeStringSeries()
     self.store['c'] = tm.makeDataFrame()
     self.store['d'] = tm.makeWidePanel()
     repr(self.store)
Пример #3
0
    def test_longpanel_series_combo(self):
        wp = tm.makeWidePanel()
        lp = wp.to_long()

        y = lp.pop('ItemA')
        model = ols(y=y, x=lp, entity_effects=True, window=20)
        self.assert_(notnull(model.beta.values).all())
        self.assert_(isinstance(model, PanelOLS))
        model.summary
Пример #4
0
    def test_panel_select(self):
        wp = tm.makeWidePanel()
        self.store.put('wp', wp, table=True)
        date = wp.major_axis[len(wp.major_axis) // 2]

        crit1 = {
            'field' : 'index',
            'op' : '>=',
            'value' : date
        }
        crit2 = {
            'field' : 'column',
            'value' : ['A', 'D']
        }

        result = self.store.select('wp', [crit1, crit2])
        expected = wp.truncate(before=date).reindex(minor=['A', 'D'])
        tm.assert_panel_equal(result, expected)
Пример #5
0
    def test_remove_crit(self):
        wp = tm.makeWidePanel()
        self.store.put('wp', wp, table=True)
        date = wp.major_axis[len(wp.major_axis) // 2]

        crit1 = {
            'field' : 'index',
            'op' : '>',
            'value' : date
        }
        crit2 = {
            'field' : 'column',
            'value' : ['A', 'D']
        }
        self.store.remove('wp', where=[crit1])
        self.store.remove('wp', where=[crit2])
        result = self.store['wp']
        expected = wp.truncate(after=date).reindex(minor=['B', 'C'])
        tm.assert_panel_equal(result, expected)
Пример #6
0
    def setUp(self):
        panel = common.makeWidePanel()
        common.add_nans(panel)

        self.panel = panel.toLong()
        self.unfiltered_panel = panel.toLong(filter_observations=False)
Пример #7
0
    def setUp(self):
        self.panel = common.makeWidePanel()

        common.add_nans(self.panel)
Пример #8
0
 def test_len(self):
     self.store['a'] = tm.makeTimeSeries()
     self.store['b'] = tm.makeStringSeries()
     self.store['c'] = tm.makeDataFrame()
     self.store['d'] = tm.makeWidePanel()
     self.assertEquals(len(self.store), 4)
Пример #9
0
 def test_wide_table(self):
     wp = tm.makeWidePanel()
     self._check_roundtrip_table(wp, tm.assert_panel_equal)