old_scripts/basicML.py
def top_nucs(dfXY, top_n):
    """
    loops through the rows of a dataframe and keeps the top_n nuclides 
    (by concentration) from each row
    
    Parameters
    ----------
    dfXY : dataframe of nuclide concentrations + labels
    top_n : number of nuclides to sort and filter by

    Returns
    -------
    nuc_set : set of the top_n nucs as determined 

    """
    
    x = len(dfXY.columns)-3
    dfX = dfXY.iloc[:, 0:x]
    # Get a set of top n nucs from each row (instance)
    nuc_set = set()
    for case, conc in dfX.iterrows():
        top_n_series = conc.sort_values(ascending=False)[:top_n]
        nuc_list = list(top_n_series.index.values)
        nuc_set.update(nuc_list)
    return nuc_set

    loops through the rows of a dataframe and keeps the top_n nuclides 
    (by concentration) from each row
    
    Parameters
    ----------
    dfXY : dataframe of nuclide concentrations + labels
    top_n : number of nuclides to sort and filter by

    Returns
    -------
    nuc_set : set of the top_n nucs as determined 

    
loops through the rows of a dataframe and keeps the top_n nuclides
(by concentration) from each row

Parameters

dfXY : dataframe of nuclide concentrations + labels
top_n : number of nuclides to sort and filter by

Returns

nuc_set : set of the top_n nucs as determined
loops through the rows of a dataframe and keeps the top_n nuclides ( by concentration ) from each row Parameters dfXY : dataframe of nuclide concentrations + labels top_n : number of nuclides to sort and filter by Returns nuc_set : set of the top_n nucs as determined
def top_nucs(dfXY, top_n):
    x = len(dfXY.columns)-3
    dfX = dfXY.iloc[:, 0:x]
    nuc_set = set()
    for case, conc in dfX.iterrows():
        top_n_series = conc.sort_values(ascending=False)[:top_n]
        nuc_list = list(top_n_series.index.values)
        nuc_set.update(nuc_list)
    return nuc_set
def top_nucs ( dfXY , top_n ) : x = len ( dfXY . columns ) - 3 dfX = dfXY . iloc [ : , 0 : x ] nuc_set = set ( ) for case , conc in dfX . iterrows ( ) : top_n_series = conc . sort_values ( ascending = False ) [ : top_n ] nuc_list = list ( top_n_series . index . values ) nuc_set . update ( nuc_list ) return nuc_set
loops through the rows of a dataframe and keeps the top_n nuclides
(by concentration) from each row
loops through the rows of a dataframe and keeps the top_n nuclides ( by concentration ) from each row
"""
    loops through the rows of a dataframe and keeps the top_n nuclides 
    (by concentration) from each row
    
    Parameters
    ----------
    dfXY : dataframe of nuclide concentrations + labels
    top_n : number of nuclides to sort and filter by

    Returns
    -------
    nuc_set : set of the top_n nucs as determined 

    """ # Get a set of top n nucs from each row (instance)
dfXY
top_n