Skip to content

Commit

Permalink
Simplified README Examples (#15338)
Browse files Browse the repository at this point in the history
Pandas will automatically perform fetches for paths detected as URLs. No need for `requests` and `StringIO`. A marginal change, but this makes the docs a bit simpler.

Authors:
  - William Kaiser (https://github.com/wkaisertexas)
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #15338
  • Loading branch information
wkaisertexas authored May 22, 2024
1 parent ad56bc3 commit f626ece
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ You can import `cudf` directly and use it like `pandas`:

```python
import cudf
import requests
from io import StringIO

url = "https://github.com/plotly/datasets/raw/master/tips.csv"
content = requests.get(url).content.decode("utf-8")

tips_df = cudf.read_csv(StringIO(content))
tips_df = cudf.read_csv("https://github.com/plotly/datasets/raw/master/tips.csv")
tips_df["tip_percentage"] = tips_df["tip"] / tips_df["total_bill"] * 100

# display average tip by dining party size
Expand All @@ -36,13 +31,8 @@ supported operations and falling back to pandas when needed:
%load_ext cudf.pandas # pandas operations now use the GPU!

import pandas as pd
import requests
from io import StringIO

url = "https://github.com/plotly/datasets/raw/master/tips.csv"
content = requests.get(url).content.decode("utf-8")

tips_df = pd.read_csv(StringIO(content))
tips_df = pd.read_csv("https://github.com/plotly/datasets/raw/master/tips.csv")
tips_df["tip_percentage"] = tips_df["tip"] / tips_df["total_bill"] * 100

# display average tip by dining party size
Expand Down

0 comments on commit f626ece

Please sign in to comment.