def test_resample_basic_from_daily(self):
        # from daily
        dti = DatetimeIndex(
            start=datetime(2005, 1, 1), end=datetime(2005, 1, 10),
            freq='D', name='index')

        s = Series(np.random.rand(len(dti)), dti)

        # to weekly
        result = s.resample('w-sun', how='last')

        self.assertEqual(len(result), 3)
        self.assertTrue((result.index.dayofweek == [6, 6, 6]).all())
        self.assertEqual(result.iloc[0], s['1/2/2005'])
        self.assertEqual(result.iloc[1], s['1/9/2005'])
        self.assertEqual(result.iloc[2], s.iloc[-1])

        result = s.resample('W-MON', how='last')
        self.assertEqual(len(result), 2)
        self.assertTrue((result.index.dayofweek == [0, 0]).all())
        self.assertEqual(result.iloc[0], s['1/3/2005'])
        self.assertEqual(result.iloc[1], s['1/10/2005'])

        result = s.resample('W-TUE', how='last')
        self.assertEqual(len(result), 2)
        self.assertTrue((result.index.dayofweek == [1, 1]).all())
        self.assertEqual(result.iloc[0], s['1/4/2005'])
        self.assertEqual(result.iloc[1], s['1/10/2005'])

        result = s.resample('W-WED', how='last')
        self.assertEqual(len(result), 2)
        self.assertTrue((result.index.dayofweek == [2, 2]).all())
        self.assertEqual(result.iloc[0], s['1/5/2005'])
        self.assertEqual(result.iloc[1], s['1/10/2005'])

        result = s.resample('W-THU', how='last')
        self.assertEqual(len(result), 2)
        self.assertTrue((result.index.dayofweek == [3, 3]).all())
        self.assertEqual(result.iloc[0], s['1/6/2005'])
        self.assertEqual(result.iloc[1], s['1/10/2005'])

        result = s.resample('W-FRI', how='last')
        self.assertEqual(len(result), 2)
        self.assertTrue((result.index.dayofweek == [4, 4]).all())
        self.assertEqual(result.iloc[0], s['1/7/2005'])
        self.assertEqual(result.iloc[1], s['1/10/2005'])

        # to biz day
        result = s.resample('B', how='last')
        self.assertEqual(len(result), 7)
        self.assertTrue((result.index.dayofweek == [4, 0, 1, 2, 3, 4, 0]).all())
        self.assertEqual(result.iloc[0], s['1/2/2005'])
        self.assertEqual(result.iloc[1], s['1/3/2005'])
        self.assertEqual(result.iloc[5], s['1/9/2005'])
        self.assertEqual(result.index.name, 'index')