summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r--numpy/lib/npyio.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index b5723dee5..3b7b3bb30 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -1062,6 +1062,13 @@ def _read(fname, *, delimiter=',', comment='#', quote='"',
arr = _ensure_ndmin_ndarray(arr, ndmin=ndmin)
+ if arr.shape[0] == 0:
+ warnings.warn(
+ f'loadtxt: input contained no data: "{fname}"',
+ category=UserWarning,
+ stacklevel=2
+ )
+
if unpack:
# Handle unpack like np.loadtxt.
# XXX Check interaction with ndmin!