Skip to content

Commit

Permalink
Fixed #63 (#71)
Browse files Browse the repository at this point in the history
* wip: pandas 2, pydantic 2 compatibility

* fixed: tests with migration to pydantic v2

* fixed: generate_v2  write files

* fixed: removed py3.7 from matrix, added py3.10, py3.11

* fixed: removed py3.7 from matrix, added py3.10, py3.11

* fixed: python 3.10 issue

* fixed: formatted with black

* adding tomli

* fixed: added tomli as dev dependency

* fixed: added tomli as dev dependency

* fixed: added tomli as dev dependency

* fixed: added tomli as dev dependency

* fixed: added tomli as dev dependency

* fixed: issue#64 - correct na_pct_velow
  • Loading branch information
Casyfill authored Aug 13, 2024
1 parent c48fb4d commit c9ab2d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dfschema/core/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ def generate_schema_dict_from_df(df: pd.DataFrame) -> dict:
columns = []

for col in df.columns:
cd = {"name": col}
cd: dict = {"name": col}

cd["dtype"] = (
"string" if pd.api.types.is_string_dtype(df[col]) else str(df[col].dtype)
)
cd["na_limit"] = max(0.9999, (df[col].isnull().mean() + 0.1)) # +10%
cd["na_pct_below"] = max(0.01, (df[col].isnull().mean() + 0.1)) # +10%

if pd.api.types.is_numeric_dtype(df[col]):
add_range = 0.05 * df[col].std()
Expand Down

0 comments on commit c9ab2d8

Please sign in to comment.