A robot-support log excerpt can contain two requested numeric rows spread across more than two physical text lines. NumPy's loadtxt does not give skiprows and max_rows the same counting rule. Treating both options as file-line offsets can select a different excerpt from the one an analyst intended.
An original offline fixture makes that difference visible using eight physical lines, two numeric columns, and invented record labels. It reads no controller, assigns no physical units, and performs no equipment update. The executed environment reports Python 3.14.7 and NumPy 2.5.2.
Number the original text before parsing it
Line one is the comment # file note. Line two is the comment # columns: record_id code. Line three contains 10 1. Line four is empty. Line five is the comment # marker. Lines six, seven, and eight contain 20 2, 30 3, and 40 4 respectively.
The first numeric column is a synthetic label, not a timestamp or measured sample count. The second is an arbitrary integer code. A line ending terminates each line, including the last. Keeping this exact text allows the original file positions to be compared with the rows in each returned array.
The fixture uses StringIO so each call starts with a fresh text stream. No call inherits a partially consumed position from an earlier test. Integer dtype and ndmin=2 keep the displayed controls as two-dimensional arrays; neither option defines which physical lines are selected.
Read the two counting rules separately
The NumPy 2.5 loadtxt reference says skiprows operates on the initial lines and includes comments. Its max_rows description excludes empty lines and comment lines from the limit, while noting that those lines do count toward skiprows. The order matters: skip the initial lines first, then apply the content-row limit. [NumPy loadtxt reference](https://numpy.org/doc/2.5/reference/generated/numpy.loadtxt.html).
In the baseline call, skiprows=2 removes the two opening comment lines. max_rows=2 then returns the numeric rows [10, 1] and [20, 2]. The intervening empty line and marker comment do not consume either of those two content-row slots.
The returned array has shape (2, 2). Its two rows originated at physical lines three and six. A description such as two file lines after the header would hide that gap and could imply that the empty fourth line ended the requested selection.
Move the physical-line boundary
A second call uses skiprows=3 and max_rows=2. It skips the two opening comments and the first numeric row. The first remaining line is empty, followed by the marker comment. The output nevertheless contains [20, 2] and [30, 3], from physical lines six and seven.
This result shows why adding one to skiprows is not generally equivalent to advancing a cursor by one returned data record. That equivalence happens at some file positions, but comments and blank lines make it unsuitable as an unstated rule for navigating the whole document.
Another control sets skiprows=5 and max_rows=2. It starts directly before physical line six and returns the same two numeric rows as the previous call. Different initial physical offsets can therefore lead to the same data excerpt when the intervening lines contain no parsed values.
Place the boundary inside the nondataset lines
With skiprows=4 and max_rows=1, the opening comments, first numeric row, and empty fourth line are skipped. The marker comment remains after that boundary, but the one requested content row is [20, 2]. The result has shape (1, 2) because the fixture explicitly requests at least two dimensions.
A separate call uses skiprows=0 and max_rows=2. It returns the same [10, 1] and [20, 2] rows as the baseline. The initial comments did not count against max_rows in this tested environment. This control separates the effect of removing the introductory comments from the effect of selecting numeric content.
Compare with an explicit physical slice
For a different requirement, the fixture passes itertools.islice over the original text stream with start two and exclusive stop four. That slice supplies only physical lines three and four: the first numeric row and the following blank line. loadtxt then returns [10, 1] alone, with shape (1, 2).
This is a separate selection contract. Limiting the physical lines supplied to the parser and limiting the data rows returned by the parser produce different excerpts here. The comparison is an original control on the same text, not a recommendation to replace one policy with the other without stating the intended window.
Preserve the version boundary
The loadtxt reference marks the relevant max_rows change as new behavior from NumPy 1.23.0. The 1.23.0 release notes explain that earlier counting of empty lines could produce fewer data rows than the requested limit even when additional data remained. [NumPy 1.23.0 release notes](https://numpy.org/doc/1.23/release/1.23.0-notes.html).
Only NumPy 2.5.2 was executed for this article. No older version was installed or run, and the historical behavior is attributed to the official release notes. The local receipt also captures warnings for each call; all five calls produced an empty warning list in this run.
Keep a row window distinct from an operational interval
These controls contain no timestamps, synchronization information, dropped-sample markers, or schema validation. Selecting two numeric rows does not establish two consecutive measurements, a fixed duration, or a complete machine event. It also does not turn max_rows into a general bound on physical lines scanned or processing time.
For a reproducible support excerpt, retain the original text identity, physical line numbering, NumPy version, parser options, selected record labels, and returned array shape. State whether the requested window refers to source lines or parsed data rows before comparing two excerpts.
Sources were checked November 19, 2026 UTC. All text, values, calls, and output comparisons are original offline editorial work. The accompanying AI-generated illustration distinguishes skipped physical lines from selected data rows; it is not an actual robot log viewer or proof of a production incident's duration.