def test_startswith(self): values = Series(['om', NA, 'foo_nom', 'nom', 'bar_foo', NA, 'foo']) result = values.str.startswith('foo') exp = Series([False, NA, True, False, False, NA, True]) tm.assert_series_equal(result, exp) # mixed mixed = ['a', NA, 'b', True, datetime.today(), 'foo', None, 1, 2.] rs = strings.str_startswith(mixed, 'f') xp = [False, NA, False, NA, NA, True, NA, NA, NA] tm.assert_almost_equal(rs, xp) rs = Series(mixed).str.startswith('f') tm.assert_isinstance(rs, Series) tm.assert_almost_equal(rs, xp) # unicode values = Series([u('om'), NA, u('foo_nom'), u('nom'), u('bar_foo'), NA, u('foo')]) result = values.str.startswith('foo') exp = Series([False, NA, True, False, False, NA, True]) tm.assert_series_equal(result, exp) result = values.str.startswith('foo', na=True) tm.assert_series_equal(result, exp.fillna(True).astype(bool))
def test_startswith(self): values = Series(["om", NA, "foo_nom", "nom", "bar_foo", NA, "foo"]) result = values.str.startswith("foo") exp = Series([False, NA, True, False, False, NA, True]) tm.assert_series_equal(result, exp) # mixed mixed = ["a", NA, "b", True, datetime.today(), "foo", None, 1, 2.0] rs = strings.str_startswith(mixed, "f") xp = [False, NA, False, NA, NA, True, NA, NA, NA] tm.assert_almost_equal(rs, xp) rs = Series(mixed).str.startswith("f") self.assert_(isinstance(rs, Series)) tm.assert_almost_equal(rs, xp) # unicode values = Series([u"om", NA, u"foo_nom", u"nom", u"bar_foo", NA, u"foo"]) result = values.str.startswith("foo") exp = Series([False, NA, True, False, False, NA, True]) tm.assert_series_equal(result, exp) result = values.str.startswith("foo", na=True) tm.assert_series_equal(result, exp.fillna(True).astype(bool))
def test_startswith(self): values = Series(['om', NA, 'foo_nom', 'nom', 'bar_foo', NA, 'foo']) result = values.str.startswith('foo') exp = Series([False, NA, True, False, False, NA, True]) tm.assert_series_equal(result, exp) #mixed mixed = ['a', NA, 'b', True, datetime.today(), 'foo', None, 1, 2.] rs = strings.str_startswith(mixed, 'f') xp = [False, NA, False, NA, NA, True, NA, NA, NA] tm.assert_almost_equal(rs, xp) rs = Series(mixed).str.startswith('f') self.assert_(isinstance(rs, Series)) tm.assert_almost_equal(rs, xp) #unicode values = Series([u'om', NA, u'foo_nom', u'nom', u'bar_foo', NA, u'foo']) result = values.str.startswith('foo') exp = Series([False, NA, True, False, False, NA, True]) tm.assert_series_equal(result, exp)
def test_startswith(self): values = Series(['om', NA, 'foo_nom', 'nom', 'bar_foo', NA, 'foo']) result = values.str.startswith('foo') exp = Series([False, NA, True, False, False, NA, True]) tm.assert_series_equal(result, exp) #mixed mixed = ['a', NA, 'b', True, datetime.today(), 'foo', None, 1, 2.] rs = strings.str_startswith(mixed, 'f') xp = [False, NA, False, NA, NA, True, NA, NA, NA] tm.assert_almost_equal(rs, xp) rs = Series(mixed).str.startswith('f') self.assert_(isinstance(rs, Series)) tm.assert_almost_equal(rs, xp) #unicode values = Series( [u'om', NA, u'foo_nom', u'nom', u'bar_foo', NA, u'foo']) result = values.str.startswith('foo') exp = Series([False, NA, True, False, False, NA, True]) tm.assert_series_equal(result, exp)