Skip to content

Commit

Permalink
Changes self arg to cls for class method
Browse files Browse the repository at this point in the history
  • Loading branch information
NEIA20 committed Apr 28, 2018
1 parent 2eb29a3 commit a663450
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fastai/column_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ def __len__(self): return len(self.y)
def __getitem__(self, idx): return [o[idx] for o in self.xs] + [self.y[idx]]

@classmethod
def from_data_frame(self, df, cols_x, col_y, is_reg=True, is_multi=False):
def from_data_frame(cls, df, cols_x, col_y, is_reg=True, is_multi=False):
""" An alternative constructor that creates an instance of PassthruDataset from a DataFrame """
cols = [df[o] for o in cols_x+[col_y]]
return self(*cols, is_reg=is_reg, is_multi=is_multi)
return cls(*cols, is_reg=is_reg, is_multi=is_multi)


class ColumnarDataset(Dataset):
Expand Down

0 comments on commit a663450

Please sign in to comment.