Skip to content

Commit d260890

Browse files
committed
Use "" for empty tables
1 parent 30f5435 commit d260890

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tables2json.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def get_tables(tables_dir):
2525
all_celltags = {}
2626
for metadata_filename in tables_dir.glob("1509*/metadata.json"):
2727
metadata = get_metadata(metadata_filename)
28+
for k in metadata:
29+
if metadata[k] is None:
30+
metadata[k] = ''
2831
basedir = metadata_filename.parent
2932
arxiv_id = basedir.name
3033
all_metadata[arxiv_id] = metadata
@@ -34,6 +37,8 @@ def get_tables(tables_dir):
3437

3538
def t2j(df):
3639
rows, cols = df.shape
40+
if rows == 0 or cols == 0:
41+
return [[""]]
3742
return [[df.iloc[r, c] for c in range(cols)] for r in range(rows)]
3843

3944

0 commit comments

Comments
 (0)