Dataframe (snippets)

    0

    0

    Inodeva

    import panadas as pd
    
    # read csv
    tp = pd.read_csv('name.csv') # if big chunksize=n iterator=True
    df = pd.concat([tp], ignore_index=True)
    
    # remove row
    df = df[:-1]
    
    #remove columns
    df = df.drop(columns=['name'])
    
    # append to df
    df_appended = pd.concat([df1,df2], axis=0, join='outer')
    
    # add column based on other columns
    df['new'] = df['base'].apply(lambda x: 'value' if else) # use df.apply if based on multiple columns
    
    # groupby
    df = df.goupby('column_name').agg('column': 'function (ie. sum)')
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.