Skip to content

Commit

Permalink
replace np.nan with blank
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Troy committed Jun 28, 2024
1 parent 449919b commit 7ec88e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions liiatools/common/stream_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import xmlschema
import tablib
import pandas as pd
import numpy as np
import xml.etree.ElementTree as ET
from io import BytesIO, StringIO
from typing import Iterable, Union, Any, Dict, List
Expand Down Expand Up @@ -105,6 +106,9 @@ def _pandas_dataframe_to_stream(dataset: pd.DataFrame, **kwargs):
for r_ix, row in enumerate(dataset.itertuples(index=False)):
yield events.StartRow()
for c_ix, cell in enumerate(row[0:]):
if isinstance(cell, float):
if np.isnan(cell):
cell = ""
yield events.Cell(
r_ix=r_ix,
c_ix=c_ix,
Expand Down

0 comments on commit 7ec88e1

Please sign in to comment.