Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Series methods isnull and notnull #209

Closed
wants to merge 3 commits into
from
View
@@ -1603,7 +1603,7 @@ def to_csv(self, path):
path : string or None
Output filepath. If None, write to stdout
"""
- f = open(path, 'wb')
+ f = open(path, 'w')
csvout = csv.writer(f)
csvout.writerows(self.iteritems())
f.close()
@@ -1619,6 +1619,9 @@ def dropna(self):
return remove_na(self)
valid = dropna
+
+ isnull = isnull
+ notnull = notnull
def first_valid_index(self):
"""
@@ -824,6 +824,18 @@ def test_valid(self):
self.assertEqual(len(result), ts.count())
common.assert_dict_equal(result, ts, compare_keys=False)
+
+ def test_isnull(self):
+ ser = Series([0,5.4,3,nan,-0.001])
+ assert_series_equal(ser.isnull(), Series([False,False,False,True,False]))
+ ser = Series(["hi","",nan])
+ assert_series_equal(ser.isnull(), Series([False,False,True]))
+
+ def test_notnull(self):
+ ser = Series([0,5.4,3,nan,-0.001])
+ assert_series_equal(ser.notnull(), Series([True,True,True,False,True]))
+ ser = Series(["hi","",nan])
+ assert_series_equal(ser.notnull(), Series([True,True,False]))
def test_shift(self):
shifted = self.ts.shift(1)
View
@@ -113,6 +113,8 @@
'Operating System :: OS Independent',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 3',
'Programming Language :: Cython',
'Topic :: Scientific/Engineering',
]