Beispiel #1
0
def test_apply_axis0(sdf, pdf):
    hdf = sdf.toHandy()
    # setting the type manually
    hres1 = hdf.apply(lambda Fare: Fare.map('${:,.2f}'.format), 'new', returnType='string').cols['new'][:]
    # setting the type using an extension
    hres2 = hdf.apply(StringType.ret(lambda Fare: Fare.map('${:,.2f}'.format)), 'new').cols['new'][:]
    res = pdf.Fare.map('${:,.2f}'.format)
    npt.assert_array_equal(hres1, res)
    npt.assert_array_equal(hres2, res)
Beispiel #2
0
def test_atomic_types():
    npt.assert_equal(IntegerType.ret('')[1], 'integer')
    npt.assert_equal(StringType.ret('')[1], 'string')
Beispiel #3
0
def test_assign_axis0(sdf, pdf):
    hdf = sdf.toHandy()
    # setting the type using an extension
    hres = hdf.assign(new=StringType.ret(lambda Fare: Fare.map('${:,.2f}'.format))).cols['new'][:]
    res = pdf.assign(new=pdf.Fare.map('${:,.2f}'.format))['new']
    npt.assert_array_equal(hres, res)