Skip to content

Instantly share code, notes, and snippets.

View dsadulla's full-sized avatar

Deepak Sadulla dsadulla

  • Convergytics
  • Bangalore, India
View GitHub Profile
@wolframalpha
wolframalpha / autofit_outliertreatment.py
Last active March 31, 2022 02:52
Function to remove or cap outliers in columns of a `pandas.DataFrame`
def treatoutliers(self, df=None, columns=None, factor=1.5, method='IQR', treament='cap'):
"""
Removes the rows from self.df whose value does not lies in the specified standard deviation
:param columns:
:param in_stddev:
:return:
"""
# if not columns:
# columns = self.mandatory_cols_ + self.optional_cols_ + [self.target_col]
if not columns:
@vakila
vakila / LilLambda.ipynb
Last active January 27, 2023 05:51
Anjana Vakil, "Mary had a little lambda", OSCON 2018 (https://conferences.oreilly.com/oscon/oscon-or/public/schedule/detail/67384) & EuroPython 2017 (https://youtu.be/7BsfMMYvGaU)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
vif_func<-function(in_frame,thresh=10,trace=T,...){
library(fmsb)
if(any(!'data.frame' %in% class(in_frame))) in_frame<-data.frame(in_frame)
#get initial vif value for all comparisons of variables
vif_init<-NULL
var_names <- names(in_frame)
for(val in var_names){