cfahlgren1 HF Staff commited on
Commit
c7deb43
·
verified ·
1 Parent(s): cf586e8

fix null serialization for empty hub stats fields

Browse files
Files changed (1) hide show
  1. hub-stats.py +5 -5
hub-stats.py CHANGED
@@ -119,11 +119,11 @@ def parse_link_header(link_header):
119
 
120
 
121
  def to_json_string(x):
122
- return (
123
- json.dumps(x)
124
- if isinstance(x, (dict, list))
125
- else str(x) if x is not None else None
126
- )
127
 
128
 
129
  def stringify_nested_columns(df):
 
119
 
120
 
121
  def to_json_string(x):
122
+ if isinstance(x, (dict, list)):
123
+ return json.dumps(x)
124
+ if x is None or pd.isna(x):
125
+ return None
126
+ return str(x)
127
 
128
 
129
  def stringify_nested_columns(df):