Skip to content

Commit c9ab2d8

Browse files
authored
Fixed #63 (#71)
* 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
1 parent c48fb4d commit c9ab2d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dfschema/core/generate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ def generate_schema_dict_from_df(df: pd.DataFrame) -> dict:
1010
columns = []
1111

1212
for col in df.columns:
13-
cd = {"name": col}
13+
cd: dict = {"name": col}
1414

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

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

0 commit comments

Comments
 (0)