src/luck_v_skill.py
def load_data(self,fund_data,factor_data,fund_names=None,factor_names=None,
        parse_dates=[['Dates'],['Dates']]):
        '''Function for loading observed fund and factor data into the AlphaEvaluator

        INPUT
        -----
        fund_data: str, numpy.array, or pandas.DataFrame
            - str is a path to a csv file
        factor_data: str, numpy.array, or pandas.DataFrame
            - str is a path to a csv file
        fund_names, factor_names: None or list
            - only needed if np.array data is passed in

        One of the factor names must be 'RF'
        '''
        # check for updates to parameters
        self.parse_dates = parse_dates
        self._is_fit = False
        self._has_sim = False
        self._has_percentiles = None

        # check for data
        if (fund_data is None) or (factor_data is None):
            raise ValueError("Funds data AND factor data must be submitted!")

        elif type(fund_data) is str:
            self.Y_raw = pd.read_csv(fund_data,parse_dates=parse_dates[0])
            self.X_raw = pd.read_csv(factor_data,parse_dates=parse_dates[1])

        elif type(fund_data) is pd.DataFrame:
            if fund_data.shape[0] != factor_data.shape[0]:
                raise ValueError("Both datasets should have same number of observations")
            self.Y_raw = fund_data
            self.X_raw = factor_data

        elif type(fund_data) is type(np.array([])):
            if (fund_names is None) or (factor_names is None):
                raise ValueError("Must input fund names and factor names")
            elif fund_data.shape[0] != factor_data.shape[0]:
                raise ValueError("Both datasets should have same number of observations")
            else:
                self.Y_raw = pd.DataFrame(data=fund_data,columns=fund_names)
                self.X_raw = pd.DataFrame(data=factor_data,columns=factor_names)
        else:
            print("Not sure what happened, but you did something wrong...")

        return self
Function for loading observed fund and factor data into the AlphaEvaluator

        INPUT
        -----
        fund_data: str, numpy.array, or pandas.DataFrame
            - str is a path to a csv file
        factor_data: str, numpy.array, or pandas.DataFrame
            - str is a path to a csv file
        fund_names, factor_names: None or list
            - only needed if np.array data is passed in

        One of the factor names must be 'RF'
        
Function for loading observed fund and factor data into the AlphaEvaluator
INPUT

str, numpy.array, or pandas.DataFrame
str is a path to a csv file
factor_data: str, numpy.array, or pandas.DataFrame
str is a path to a csv file
fund_names, factor_names: None or list
only needed if np.array data is passed in

One of the factor names must be 'RF'
Function for loading observed fund and factor data into the AlphaEvaluator INPUT str numpy . array or pandas . DataFrame str is a path to a csv file factor_data : str numpy . array or pandas . DataFrame str is a path to a csv file fund_names factor_names : None or list only needed if np . array data is passed in One of the factor names must be ' RF '
def load_data(self,fund_data,factor_data,fund_names=None,factor_names=None,
        parse_dates=[['Dates'],['Dates']]):
        self.parse_dates = parse_dates
        self._is_fit = False
        self._has_sim = False
        self._has_percentiles = None
        if (fund_data is None) or (factor_data is None):
            raise ValueError("Funds data AND factor data must be submitted!")
        elif type(fund_data) is str:
            self.Y_raw = pd.read_csv(fund_data,parse_dates=parse_dates[0])
            self.X_raw = pd.read_csv(factor_data,parse_dates=parse_dates[1])
        elif type(fund_data) is pd.DataFrame:
            if fund_data.shape[0] != factor_data.shape[0]:
                raise ValueError("Both datasets should have same number of observations")
            self.Y_raw = fund_data
            self.X_raw = factor_data
        elif type(fund_data) is type(np.array([])):
            if (fund_names is None) or (factor_names is None):
                raise ValueError("Must input fund names and factor names")
            elif fund_data.shape[0] != factor_data.shape[0]:
                raise ValueError("Both datasets should have same number of observations")
            else:
                self.Y_raw = pd.DataFrame(data=fund_data,columns=fund_names)
                self.X_raw = pd.DataFrame(data=factor_data,columns=factor_names)
        else:
            print("Not sure what happened, but you did something wrong...")
        return self
def load_data ( self , fund_data , factor_data , fund_names = None , factor_names = None , parse_dates = [ [ 'Dates' ] , [ 'Dates' ] ] ) : self . parse_dates = parse_dates self . _is_fit = False self . _has_sim = False self . _has_percentiles = None if ( fund_data is None ) or ( factor_data is None ) : raise ValueError ( "Funds data AND factor data must be submitted!" ) elif type ( fund_data ) is str : self . Y_raw = pd . read_csv ( fund_data , parse_dates = parse_dates [ 0 ] ) self . X_raw = pd . read_csv ( factor_data , parse_dates = parse_dates [ 1 ] ) elif type ( fund_data ) is pd . DataFrame : if fund_data . shape [ 0 ] != factor_data . shape [ 0 ] : raise ValueError ( "Both datasets should have same number of observations" ) self . Y_raw = fund_data self . X_raw = factor_data elif type ( fund_data ) is type ( np . array ( [ ] ) ) : if ( fund_names is None ) or ( factor_names is None ) : raise ValueError ( "Must input fund names and factor names" ) elif fund_data . shape [ 0 ] != factor_data . shape [ 0 ] : raise ValueError ( "Both datasets should have same number of observations" ) else : self . Y_raw = pd . DataFrame ( data = fund_data , columns = fund_names ) self . X_raw = pd . DataFrame ( data = factor_data , columns = factor_names ) else : print ( "Not sure what happened, but you did something wrong..." ) return self
Function for loading observed fund and factor data into the AlphaEvaluator
INPUT
Function for loading observed fund and factor data into the AlphaEvaluator INPUT
'''Function for loading observed fund and factor data into the AlphaEvaluator

        INPUT
        -----
        fund_data: str, numpy.array, or pandas.DataFrame
            - str is a path to a csv file
        factor_data: str, numpy.array, or pandas.DataFrame
            - str is a path to a csv file
        fund_names, factor_names: None or list
            - only needed if np.array data is passed in

        One of the factor names must be 'RF'
        ''' # check for updates to parameters # check for data
self
fund_data
factor_data
fund_names
factor_names
parse_dates