Skip to content

Commit

Permalink
Making sure behavior is consistent wrt Py2/Py3
Browse files Browse the repository at this point in the history
Range returns an iterable in Python3. Making sure result is a list
always.

Signed-off-by: Jonas Kalderstam <jonas@kalderstam.se>
  • Loading branch information
spacecowboy committed Nov 27, 2014
1 parent 5650dff commit c838831
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lifelines/estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,10 +1194,10 @@ def _compute_baseline_hazard(self):
#### Utils ####
def get_index(X):
if isinstance(X, pd.DataFrame):
index = list(X.index)
index = list(X.index)

This comment has been minimized.

Copy link
@spacecowboy

spacecowboy Nov 27, 2014

Author Collaborator

Also fixed indentation to be a multiple of 4 (was 3)

else:
# If it's not a dataframe, order is up to user
index = range(X.shape[0])
# If it's not a dataframe, order is up to user
index = list(range(X.shape[0]))

This comment has been minimized.

Copy link
@spacecowboy

spacecowboy Nov 27, 2014

Author Collaborator

Could do np.arange(..), but other case returns a list so wanted to be consistent.

return index


Expand Down

0 comments on commit c838831

Please sign in to comment.