@@ -426,7 +426,7 @@ def infer_cardinality(self, scope: Optional[List[str]] = None) -> None:
426426 # Helper function to transform a row into a string that represents
427427 # a subject (or object) in a given scope; `side` is either `subject`
428428 # or `object`.
429- def _to_string (row : dict [ str , Any ] , side : str ) -> str :
429+ def _to_string (row : pd . Series , side : str ) -> str :
430430 # We prepend a one-letter code (`L` or `E`) to the actual subject
431431 # or object so that literal and non-literal mapping records are
432432 # always distinguishable and can be counted separately.
@@ -718,7 +718,6 @@ def filter_redundant_rows(df: pd.DataFrame, ignore_predicate: bool = False) -> p
718718 key = [SUBJECT_ID , OBJECT_ID ]
719719 else :
720720 key = [SUBJECT_ID , OBJECT_ID , PREDICATE_ID ]
721- dfmax : pd .DataFrame
722721 if not df .empty :
723722 dfmax = df .groupby (key , as_index = False )[CONFIDENCE ].apply (max ).drop_duplicates ()
724723 max_conf : Dict [Tuple [str , ...], float ] = {}
@@ -1197,7 +1196,9 @@ def deal_with_negation(df: pd.DataFrame) -> pd.DataFrame:
11971196
11981197 # GroupBy and SELECT ONLY maximum confidence
11991198 max_confidence_df : pd .DataFrame
1200- max_confidence_df = combined_normalized_subset .groupby (TRIPLES_IDS , as_index = False )[
1199+ max_confidence_df = combined_normalized_subset .groupby (
1200+ TRIPLES_IDS , as_index = False
1201+ )[ # type:ignore
12011202 CONFIDENCE
12021203 ].max ()
12031204
@@ -1267,14 +1268,14 @@ def deal_with_negation(df: pd.DataFrame) -> pd.DataFrame:
12671268 # This needs to happen because the columns in df
12681269 # not in reconciled_df_subset will be NaN otherwise
12691270 # which is incorrect.
1270- reconciled_df = df .merge (
1271+ reconciled_df : pd . DataFrame = df .merge (
12711272 reconciled_df_subset , how = "right" , on = list (reconciled_df_subset .columns )
12721273 ).fillna (df )
12731274
12741275 if nan_df .empty :
12751276 return_df = reconciled_df
12761277 else :
1277- return_df = reconciled_df .append (nan_df ).drop_duplicates ()
1278+ return_df = reconciled_df .append (nan_df ).drop_duplicates () # type:ignore
12781279
12791280 if not confidence_in_original :
12801281 return_df = return_df .drop (columns = [CONFIDENCE ], axis = 1 )
0 commit comments