File size: 1,464 Bytes
157df14
 
 
 
 
 
 
 
7f49828
157df14
 
 
 
 
 
 
 
 
 
 
 
 
7f49828
 
 
 
 
 
 
157df14
7f49828
 
 
 
 
 
 
 
 
 
 
 
157df14
7f49828
 
157df14
7f49828
157df14
7f49828
 
 
157df14
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import gradio as gr
import pandas as pd

OG_DF = pd.read_csv("All_Robots_Combined_Labeled.csv")
FILTER_DF = pd.read_csv("All_Robots_Combined_Labeled.csv")



def robot(show, df, col_name): 
    """

    Determines whether robot 1 should be shown in the data frame 



    args: 

        show - Boolean

            Determines whether robot 1 should be shown in the CSV file or not 

        robot_num - int

            The number of the robot the filter is applying to 



    returns: 

        nothing

    """
    
    if not show and col_name in df: 
        df.drop(col_name)
    elif show and col_name not in df: 
        df.insert(OG_DF[col_name])
        
    return df

    
def row_filter(show, val, col, df):
    "Filter out values in specified column"
    "TODO: Add rest of func definition"

    if show:
        b = OG_DF[OG_DF[col] == val]
        df = pd.concat([df, b])
    elif not show: 
        df = df[df[col] != val]

    return df 


def select_all():
    "Select all options in the filter and restore the dataframe"

    return OG_DF, *[gr.update(value=True)] * 21

def clear_all():
    "Deselect all options in the filter and remove all rows in the dataframe"
    return pd.DataFrame, *[gr.update(value=True)] * 21

def apply():
    """

        Applies the filter dataframe to the dataframe in the frontend 



        Returns: 

            Filter dataframe 

    """

    return FILTER_DF