removed "where" method from Table class
This commit is contained in:
parent
4877334986
commit
36e4042f0b
|
@ -49,15 +49,6 @@ class Table:
|
||||||
"""Copy Table."""
|
"""Copy Table."""
|
||||||
return self.__copy__()
|
return self.__copy__()
|
||||||
|
|
||||||
def where(self,expression):
|
|
||||||
"""
|
|
||||||
Return boolean array corresponding to interpolated expression being True.
|
|
||||||
|
|
||||||
Table columns are addressed as #column# and will have appropriate shapes.
|
|
||||||
|
|
||||||
"""
|
|
||||||
return eval(re.sub('#(.+?)#',r'self.get("\1")',expression))
|
|
||||||
|
|
||||||
|
|
||||||
def _label_discrete(self):
|
def _label_discrete(self):
|
||||||
"""Label data individually, e.g. v v v ==> 1_v 2_v 3_v."""
|
"""Label data individually, e.g. v v v ==> 1_v 2_v 3_v."""
|
||||||
|
|
|
@ -44,12 +44,6 @@ class TestTable:
|
||||||
def test_getitem(self,N):
|
def test_getitem(self,N):
|
||||||
assert len(Table(np.random.rand(N,1),{'X':1})[:N//2]) == N//2
|
assert len(Table(np.random.rand(N,1),{'X':1})[:N//2]) == N//2
|
||||||
|
|
||||||
@pytest.mark.parametrize('N',[10,40])
|
|
||||||
@pytest.mark.parametrize('limit',[0.1,0.6])
|
|
||||||
def test_where(self,N,limit):
|
|
||||||
r = Table(np.random.rand(N,1),{'X':1})
|
|
||||||
assert np.all(r[r.where(f'#X# > {limit}')].get('X') > limit)
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('mode',['str','path'])
|
@pytest.mark.parametrize('mode',['str','path'])
|
||||||
def test_write_read(self,default,tmp_path,mode):
|
def test_write_read(self,default,tmp_path,mode):
|
||||||
default.save(tmp_path/'default.txt')
|
default.save(tmp_path/'default.txt')
|
||||||
|
|
Loading…
Reference in New Issue