Skip to content

Commit

Permalink
Fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
davipatti committed Jul 6, 2018
1 parent ba97242 commit f619d5c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pymds/mds.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ class DistanceMatrix(object):

def __init__(self, path_or_array_like, na_values='*'):
if type(path_or_array_like) is str:
self.D = pd.read_csv(
df = pd.read_csv(
path_or_array_like, index_col=0, na_values=na_values)
self.D = df.values
self.index = df.index

else:
if path_or_array_like.ndim != 2:
Expand All @@ -37,6 +39,7 @@ def __init__(self, path_or_array_like, na_values='*'):

if type(path_or_array_like) is pd.DataFrame:
self.D = path_or_array_like.values
self.index = path_or_array_like.index
else:
self.D = path_or_array_like

Expand Down Expand Up @@ -145,7 +148,7 @@ def optimise(self, start=None, n=2):
jac=True,
method='L-BFGS-B')

index = self.D.index if hasattr(self.D, "index") else None
index = self.index if hasattr(self, "index") else None

return Projection(optim, n=self.n, m=self.m, index=index)

Expand Down

0 comments on commit f619d5c

Please sign in to comment.