Skip to content

Conversation

drbenvincent
Copy link
Collaborator

Move to more idiomatic pandas data loading.

An example...

Before

df = cp.load_data("covid")
df["date"] = pd.to_datetime(df["date"])
df = df.set_index("date")

After

df = (
    cp.load_data("covid")
    .assign(date=lambda x: pd.to_datetime(x["date"]))
    .set_index("date")
)

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@drbenvincent drbenvincent changed the title improve data import with method chaining Idiomatic data import and processing with pandas method chaining for all examples Jan 6, 2023
@drbenvincent drbenvincent merged commit 77dbbe9 into main Jan 6, 2023
@drbenvincent drbenvincent deleted the improve-data-import branch January 6, 2023 08:55
@drbenvincent drbenvincent added the documentation Improvements or additions to documentation label May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant