Skip to content

Commit

Permalink
Replace deprecated delim_whitespace parameter to sep='\s+' in pd.read…
Browse files Browse the repository at this point in the history
…_csv (#2932)
  • Loading branch information
seisman authored Dec 29, 2023
1 parent 5e4388b commit 21a8722
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
14 changes: 6 additions & 8 deletions pygmt/datasets/samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _load_japan_quakes():
return pd.read_csv(
fname,
header=1,
delim_whitespace=True,
sep=r"\s+",
names=[
"year",
"month",
Expand All @@ -52,7 +52,7 @@ def _load_ocean_ridge_points():
fname = which("@ridge.txt", download="c")
return pd.read_csv(
fname,
delim_whitespace=True,
sep=r"\s+",
names=["longitude", "latitude"],
skiprows=1,
comment=">",
Expand Down Expand Up @@ -102,9 +102,7 @@ def _load_fractures_compilation():
the fractures.
"""
fname = which("@fractures_06.txt", download="c")
data = pd.read_csv(
fname, header=None, delim_whitespace=True, names=["azimuth", "length"]
)
data = pd.read_csv(fname, header=None, sep=r"\s+", names=["azimuth", "length"])
return data[["length", "azimuth"]]


Expand Down Expand Up @@ -167,7 +165,7 @@ def _load_rock_sample_compositions():
fname = which("@ternary.txt", download="c")
return pd.read_csv(
fname,
delim_whitespace=True,
sep=r"\s+",
header=None,
names=["limestone", "water", "air", "permittivity"],
)
Expand All @@ -183,7 +181,7 @@ def _load_notre_dame_topography():
The data table with columns "x", "y", and "z".
"""
fname = which("@Table_5_11.txt", download="c")
return pd.read_csv(fname, delim_whitespace=True, header=None, names=["x", "y", "z"])
return pd.read_csv(fname, sep=r"\s+", header=None, names=["x", "y", "z"])


def _load_maunaloa_co2():
Expand All @@ -197,7 +195,7 @@ def _load_maunaloa_co2():
"""
fname = which("@MaunaLoa_CO2.txt", download="c")
return pd.read_csv(
fname, header=None, skiprows=1, delim_whitespace=True, names=["date", "co2_ppm"]
fname, header=None, skiprows=1, sep=r"\s+", names=["date", "co2_ppm"]
)


Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def fixture_data():
"""
Load the point data from the test file.
"""
return pd.read_table(POINTS_DATA, header=None, delim_whitespace=True)
return pd.read_table(POINTS_DATA, header=None, sep=r"\s+")


@pytest.fixture(scope="module", name="region")
Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_grdtrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def fixture_dataframe():
Load a pandas DataFrame with points.
"""
return pd.read_csv(
POINTS_DATA, delim_whitespace=True, header=None, names=["longitude", "latitude"]
POINTS_DATA, sep=r"\s+", header=None, names=["longitude", "latitude"]
)


Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def fixture_data():
"""
fname = which("@Table_5_11_mean.xyz", download="c")
return pd.read_csv(
fname, delim_whitespace=True, header=None, names=["x", "y", "z"], skiprows=1
fname, sep=r"\s+", header=None, names=["x", "y", "z"], skiprows=1
)


Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_triangulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def fixture_dataframe():
"""
fname = which("@Table_5_11_mean.xyz", download="c")
return pd.read_csv(
fname, delim_whitespace=True, header=None, names=["x", "y", "z"], skiprows=1
fname, sep=r"\s+", header=None, names=["x", "y", "z"], skiprows=1
)[:10]


Expand Down

0 comments on commit 21a8722

Please sign in to comment.