Skip to content
Snippets Groups Projects
Commit c8f83eea authored by Bert Palm's avatar Bert Palm 🎇
Browse files

fixed squeeze (what a trouble a missing commata can do...).

added simple __repr__ and __str__.
parent 408e3be2
No related branches found
No related tags found
1 merge request!218Flags
...@@ -210,6 +210,8 @@ class Backtrack: ...@@ -210,6 +210,8 @@ class Backtrack:
""" """
Squeeze last `n` columns to a single column. Squeeze last `n` columns to a single column.
This **not** changes the result of ``Backtrack.max()``.
Parameters Parameters
---------- ----------
n : int n : int
...@@ -245,7 +247,7 @@ class Backtrack: ...@@ -245,7 +247,7 @@ class Backtrack:
# because anytime force was given, the False's in # because anytime force was given, the False's in
# the mask were propagated back over the whole BT # the mask were propagated back over the whole BT
mask = self.mask.iloc[:, -n:] mask = self.mask.iloc[:, -n:]
bt = self.bt.iloc[: -n:] bt = self.bt.iloc[:, -n:]
s = bt[mask].max(axis=1) s = bt[mask].max(axis=1)
# slice self down # slice self down
...@@ -289,6 +291,12 @@ class Backtrack: ...@@ -289,6 +291,12 @@ class Backtrack:
def __len__(self) -> int: def __len__(self) -> int:
return len(self.bt.columns) return len(self.bt.columns)
def __repr__(self):
return self.bt.__repr__()
def __str__(self):
return self.bt.__str__()
# -------------------------------------------------------------------------------- # --------------------------------------------------------------------------------
# validation # validation
# #
...@@ -350,8 +358,3 @@ class Backtrack: ...@@ -350,8 +358,3 @@ class Backtrack:
raise ValueError('dtype must be float') raise ValueError('dtype must be float')
return obj return obj
if __name__ == '__main__':
b = Backtrack(bt=pd.DataFrame(range(6), columns=[0], dtype=float))
b = Backtrack(bt=pd.DataFrame(dtype=float))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment