Skip to content

Commit

Permalink
feat: add support for python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
vorel99 committed Dec 16, 2023
1 parent 16c64c9 commit bcf3b49
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/ydata_profiling/model/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def check_correlation_alerts(config: Settings, correlations: dict) -> List[Alert
def get_alerts(
config: Settings,
table_stats: dict,
series_description: dict[str, VarDescription],
series_description: Dict[str, VarDescription],
correlations: dict,
) -> List[Alert]:
alerts: List[Alert] = check_table_alerts(table_stats)
Expand Down
2 changes: 1 addition & 1 deletion src/ydata_profiling/model/describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def describe(

# Variable-specific
pbar.total += len(df.columns)
series_description: dict[str, VarDescription] = get_series_descriptions(
series_description: Dict[str, VarDescription] = get_series_descriptions(
config, df, summarizer, typeset, pbar
)

Expand Down
14 changes: 7 additions & 7 deletions src/ydata_profiling/model/pandas/correlations_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import itertools
import warnings
from typing import Callable, Optional
from typing import Callable, Dict, Optional

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -86,9 +86,9 @@ def _pairwise_cramers(col_1: pd.Series, col_2: pd.Series) -> float:
return _cramers_corrected_stat(pd.crosstab(col_1, col_2), correction=True)


@Cramers.compute.register(Settings, pd.DataFrame, dict[str, VarDescription])
@Cramers.compute.register(Settings, pd.DataFrame, Dict[str, VarDescription])
def pandas_cramers_compute(
config: Settings, df: pd.DataFrame, summary: dict[str, VarDescription]
config: Settings, df: pd.DataFrame, summary: Dict[str, VarDescription]
) -> Optional[pd.DataFrame]:
threshold = config.categorical_maximum_correlation_distinct

Expand Down Expand Up @@ -127,9 +127,9 @@ def pandas_cramers_compute(
return correlation_matrix


@PhiK.compute.register(Settings, pd.DataFrame, dict[str, VarDescription])
@PhiK.compute.register(Settings, pd.DataFrame, Dict[str, VarDescription])
def pandas_phik_compute(
config: Settings, df: pd.DataFrame, summary: dict[str, VarDescription]
config: Settings, df: pd.DataFrame, summary: Dict[str, VarDescription]
) -> Optional[pd.DataFrame]:
df_cols_dict = {i: list(df.columns).index(i) for i in df.columns}

Expand Down Expand Up @@ -163,9 +163,9 @@ def pandas_phik_compute(
return correlation


@Auto.compute.register(Settings, pd.DataFrame, dict[str, VarDescription])
@Auto.compute.register(Settings, pd.DataFrame, Dict[str, VarDescription])
def pandas_auto_compute(
config: Settings, df: pd.DataFrame, summary: dict[str, VarDescription]
config: Settings, df: pd.DataFrame, summary: Dict[str, VarDescription]
) -> Optional[pd.DataFrame]:
threshold = config.categorical_maximum_correlation_distinct
numerical_columns = [
Expand Down
4 changes: 2 additions & 2 deletions src/ydata_profiling/model/pandas/summary_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import multiprocessing
import multiprocessing.pool
from typing import Tuple
from typing import Dict, Tuple

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -65,7 +65,7 @@ def pandas_get_series_descriptions(
summarizer: BaseSummarizer,
typeset: VisionsTypeset,
pbar: tqdm,
) -> dict[str, VarDescription]:
) -> Dict[str, VarDescription]:
def multiprocess_1d(args: tuple) -> Tuple[str, VarDescription]:
"""Wrapper to process series in parallel.
Expand Down
3 changes: 2 additions & 1 deletion src/ydata_profiling/model/pandas/table_pandas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from collections import Counter
from typing import Dict

import pandas as pd

Expand All @@ -9,7 +10,7 @@

@get_table_stats.register
def pandas_get_table_stats(
config: Settings, df: pd.DataFrame, variable_stats: dict[str, VarDescription]
config: Settings, df: pd.DataFrame, variable_stats: Dict[str, VarDescription]
) -> dict:
"""General statistics for the DataFrame.
Expand Down
4 changes: 2 additions & 2 deletions src/ydata_profiling/model/summary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Compute statistical description of datasets."""

from typing import Any
from typing import Any, Dict

from multimethod import multimethod
from tqdm import tqdm
Expand Down Expand Up @@ -28,5 +28,5 @@ def get_series_descriptions(
summarizer: BaseSummarizer,
typeset: VisionsTypeset,
pbar: tqdm,
) -> dict[str, VarDescription]:
) -> Dict[str, VarDescription]:
raise NotImplementedError()

0 comments on commit bcf3b49

Please sign in to comment.