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
feat: Format timestamps as timestamps #230
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 suggestions, 1) on the performance of the datetime casting, and 2) on simplifying the if/else
statement
if columns is None: | ||
return pd.DataFrame(data=data, columns=default_columns) | ||
df = pd.DataFrame(data=data, columns=default_columns) | ||
elif columns == "all": | ||
return pd.DataFrame(data=data) | ||
df = pd.DataFrame(data=data) | ||
else: | ||
return pd.DataFrame(data=data, columns=columns) | ||
df = pd.DataFrame(data=data, columns=columns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could simplify this slightly
columns = columns or default_columns # handles None 'if' clause
if columns == 'all':
df = pd.DataFrame(data=data)
else:
df = pd.DataFrame(data=data, columns=columns)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely fewer lines of code - but I think it's slightly more difficult to read for the user: we mutate the columns variable and then handle it in the if statement - rather than explicitly dealing with the three posibilities for the columns variable..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your call!
Closes #49