From f626ece7e3639c53096bd06ec40cf48ccd807f93 Mon Sep 17 00:00:00 2001 From: William Kaiser Date: Wed, 22 May 2024 15:16:46 -0400 Subject: [PATCH] Simplified README Examples (#15338) 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: https://github.com/rapidsai/cudf/pull/15338 --- README.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 205e16ea0e5..75ee405bc1f 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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