Skip to content

nwis.get_pmcodes returns HTML page instead of parameter table #215

@nodohs

Description

@nodohs

Summary

dataretrieval.nwis.get_pmcodes() appears to return an HTML webpage response parsed into a one-column dataframe, rather than tabular parameter metadata.

Minimal reproducible example

from dataretrieval import nwis

df, meta = nwis.get_pmcodes(["00631"])

print("shape:", df.shape)
print("columns:", df.columns.tolist())
print("url:", getattr(meta, "url", None))
print("content-type:", getattr(meta, "header", {}).get("Content-Type"))
print(df.head(5).to_string(index=False))

Actual output:

shape: (368, 1)
columns: ['<!DOCTYPE html>']
url: https://waterdata.usgs.gov/code-dictionary/
content-type: text/html; charset=utf-8

Expected behavior

nwis.get_pmcodes(["00631"]) should return a dataframe with parameter metadata fields (for example: parameter code, parameter name, units), not HTML content.

Environment

dataretrieval: 1.1.2
Python: 3.14.2
OS: macOS

Suspected cause

Upstream endpoint change/redirect/decommission.

Notes

Check how and whether this was addressed in DataRetrieval.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions