Skip to content

Commit 026f6e4

Browse files
committed
Fix a bug in n_rows
1 parent 3161963 commit 026f6e4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pygmt/clib/session.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,10 +1669,12 @@ def virtualfile_from_stringio(self, stringio: io.StringIO):
16691669
if current_segment["data"]: # Add the last segment if it has data
16701670
segments.append(current_segment)
16711671

1672-
# One table with one or more segments. No numeric data, so n_columns is 0.
1672+
# One table with one or more segments.
1673+
# n_rows is the maximum number of rows/records for all segments.
1674+
# n_columns is the number of numeric data columns, so it's 0 here.
16731675
n_tables = 1
16741676
n_segments = len(segments)
1675-
n_rows = sum(len(segment["data"]) for segment in segments)
1677+
n_rows = max(len(segment["data"]) for segment in segments)
16761678
n_columns = 0
16771679

16781680
# Create the GMT_DATASET container

0 commit comments

Comments
 (0)