Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev analysis #25

Merged
merged 12 commits into from
Dec 15, 2020
Merged

Dev analysis #25

merged 12 commits into from
Dec 15, 2020

Conversation

RyKoe
Copy link
Collaborator

@RyKoe RyKoe commented Dec 14, 2020

I couldn't get Datafill to 100% coverage its at 95% right now. I think Debangsha said in the lab he wasn't going to be a stickler for exactly 100%. Linear has trouble getting high coverage due to the lines of code that create graphs.

@RyKoe RyKoe closed this Dec 14, 2020
@RyKoe RyKoe reopened this Dec 14, 2020
@mqharris
Copy link
Owner

mqharris commented Dec 14, 2020

From the assignment sheet:
[6 marks] At least six methods will contain appropriate error and exception handlers (out of six exceptions, two exceptions should be user-defined exceptions).

I could not find any user-defined exceptions, I'm willing to admit that I might have missed them.

try:
assert (isinstance(column, int) or column in self.data)
return self.data.dtypes[column]
except:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its generally frowned upon to not catch specific errors.
Although this try and except block is simple, having try excepts without specific errors can hide trivial bugs easily.

Also, lab4.md say At least six methods will contain appropriate error and exception handlers which in my reading is catching specific errors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding to Mitch's comments, you can just change your code to be except AssertError, or you can create your own user defined error class and do something along the lines of if not is instance(x, y) raise UserErrorClass() then you can use except UserErrorClass:

return self.data.dtypes[column]
except:
print("Please enter an integer or the name of a column")
return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically I don't think a return statement is needed on line 67

return DataEdit(self.data.append(other, ignore_index=True))
except:
print("Not a Pandas data frame.")
return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return statement not needed on 92

return DataEdit(common)
print("Not a Pandas data frame.")
return


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about return and nested try statements are maybe not ideal - is the inner one needed?

Copy link
Owner

@mqharris mqharris Dec 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this seems a little funky

I think it could be replaced with

try:
    statement0
except ExceptionTypeOne:
    statement1
except ExceptionTypeTwo:
    statement2

assert isinstance(self.data, pd.core.frame.DataFrame)
except:
print("Not a Pandas data frame.")
return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment

@WraySmith
Copy link
Collaborator

looks good to me now, tbh I didn't really review it in great detail just skimmed it and it looked like its all good now

@RyKoe RyKoe merged commit 77d4922 into develop Dec 15, 2020
@RyKoe RyKoe deleted the dev_analysis branch December 15, 2020 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants