Skip to content

Commit

Permalink
Change pandas_list enforce_type df construction (#72)
Browse files Browse the repository at this point in the history
* Change pandas_list enforce_type df construction

* Change pandas_list enforce_type df construction
  • Loading branch information
goodwanghan committed Oct 20, 2021
1 parent 7b9fec9 commit ece1754
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ pip install triad

## Release History

### 0.5.5

* Change pandas_list enforce_type df construction

### 0.5.4

* Make `FileSystem` work for windows
Expand Down
5 changes: 3 additions & 2 deletions triad/utils/pandas_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def enforce_type( # noqa: C901
return df
if not null_safe:
return df.astype(dtype=to_pandas_dtype(schema))
data: Dict[str, Any] = {}
for v in schema:
s = df[v.name]
if pa.types.is_string(v.type):
Expand All @@ -163,8 +164,8 @@ def enforce_type( # noqa: C901
s = s.fillna(0).astype(v.type.to_pandas_dtype()).mask(ns, None)
elif not pa.types.is_struct(v.type) and not pa.types.is_list(v.type):
s = s.astype(v.type.to_pandas_dtype())
df[v.name] = s
return df
data[v.name] = s
return pd.DataFrame(data)

def safe_groupby_apply(
self,
Expand Down
2 changes: 1 addition & 1 deletion triad_version/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.4"
__version__ = "0.5.5"

0 comments on commit ece1754

Please sign in to comment.