Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
enzbus committed Sep 5, 2023
1 parent 469951e commit 85c3c6b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cvxportfolio/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ def _universe_subselect(self, data):
except KeyError:
raise MissingValuesError(
f"The pandas Series found by {self.__class__.__name__} has index {self.data.index}"
f" while the current universe (minus cash) is {self.universe_maybe_noncash}."
" It was not possibly to reconcile the two.")
f" while the current universe {'minus cash' if not self.data_includes_cash else ''}"
f" is {self.universe_maybe_noncash}. It was not possibly to reconcile the two.")

if isinstance(data, pd.DataFrame):
try:
Expand All @@ -267,15 +267,16 @@ def _universe_subselect(self, data):
raise MissingValuesError(
f"The pandas DataFrame found by {self.__class__.__name__} has index {self.data.index}"
f" and columns {self.data.columns}"
f" while the current universe (minus cash) is {self.universe_maybe_noncash}."
" It was not possibly to reconcile the two.")
f" while the current universe {'minus cash' if not self.data_includes_cash else ''}"
f" is {self.universe_maybe_noncash}. It was not possibly to reconcile the two.")

if isinstance(data, np.ndarray):
dimensions = data.shape
if not len(self.universe_maybe_noncash) in dimensions:
raise MissingValuesError(
f"The numpy array found by {self.__class__.__name__} has dimensions {self.data.shape}"
f" while the current universe (minus cash) has size {len(self.universe_maybe_noncash)}.")
f" while the current universe {'minus cash' if not self.data_includes_cash else ''}"
f" has size {len(self.universe_maybe_noncash)}.")
return data

# scalar
Expand Down

0 comments on commit 85c3c6b

Please sign in to comment.