コード例 #1
0
def test_interpolate():

    dm = DataMatrix(length=3)
    dm.s = SeriesColumn(depth=4)
    dm.s = 1, 2, 3, 4
    dm.s[0] = np.nan
    dm.s[1, 0] = np.nan
    dm.s[1, 2] = np.nan
    dm.i = series.interpolate(dm.s)
    check_series(dm.i, [[np.nan] * 4, [2, 2, 3, 4], [1, 2, 3, 4]])
コード例 #2
0
def check_mixedcolumn_typing():

	dm = DataMatrix(length=4)
	dm.i = 1, '1', 2, '2'
	ok_(all(isinstance(v, int) for v in dm.i))
	dm.f = 1.1, '1.1', 2.1, '2.2'
	ok_(all(isinstance(v, float) for v in dm.f))
	dm.inf = INF, -INF, 'inf', '-inf'
	ok_(all(math.isinf(v) for v in dm.inf))
	dm.nan = NAN, NAN, 'nan', 'nan'
	ok_(all(math.isnan(v) for v in dm.nan))
	dm.none = None, None, None, None
	ok_(all(v is None for v in dm.none))
	dm.s = 'alpha', 'beta', 'None', ''
	ok_(all(isinstance(v, str) for v in dm.s))
	@raises(TypeError)
	def _():
		dm.err = Exception, tuple, str, map
	_()