Skip to content

Commit

Permalink
Explicitly use Python engine for pandas (#435)
Browse files Browse the repository at this point in the history
Pandas was giving the following warning:

```
/Users/cthoyt/dev/sssom-py/src/sssom/parsers.py:147: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support sep=None with delim_whitespace=False; you can avoid this warning by specifying engine='python'.
  df = pd.read_csv(table_stream, sep=sep, dtype=str)
```

This PR explicitly specifies the engine to be "python" as suggested.
Another alternative would be to set the separator to tab by default,
since I don't think we allow SSSOM in CSV (or at least we shouldn't :p)
  • Loading branch information
cthoyt authored Oct 2, 2023
1 parent 41bcdca commit e06a4c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sssom/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _read_pandas_and_metadata(input: io.StringIO, sep: str = None):
table_stream, metadata_stream = _separate_metadata_and_table_from_stream(input)

try:
df = pd.read_csv(table_stream, sep=sep, dtype=str)
df = pd.read_csv(table_stream, sep=sep, dtype=str, engine="python")
df.fillna("", inplace=True)
except EmptyDataError as e:
logging.warning(f"Seems like the dataframe is empty: {e}")
Expand Down

0 comments on commit e06a4c6

Please sign in to comment.