Skip to content

Commit

Permalink
fix: added docstring re: TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
awlh18 committed Feb 1, 2025
1 parent 9e0b537 commit 96a511f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/linreg_ally/multicollinearity.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ def check_multicollinearity(train_df: pd.DataFrame, threshold = None, vif_only =
alt.Chart
A chart that shows the pairwise Pearson Correlations of all numeric columns in train_df.
Raises
------
TypeError
If `train_df` is not a pandas DataFrame.
Examples
--------
>>> from linreg_ally.multicollinearity import check_multicollinearity
>>> vif_df, corr_chart = check_multicollinearity(train_df)
>>> vif_df = check_multicollinearity(train_df, threshold = 5, vif_only = True)
"""
if not isinstance(train_df, pd.DataFrame):
raise TypeError(f"Expect train_df to be a pd.Dataframe but got {type(train_df)}")

# select only numeric columns in train_df
train_df_numeric_only = train_df.select_dtypes(include='number')

Expand Down

0 comments on commit 96a511f

Please sign in to comment.