How can I remove the first column of pandas numbers

Asked

Viewed 1,186 times

0

Can anyone tell me how I can remove the first column of output of pandas and pepper column?

Image of what I want to remove: inserir a descrição da imagem aqui

My CSV:

Link: https://drive.google.com/file/d/16mDhKkVIqzS43SDUd6BAHDP6ZUUoeu52/view?usp=sharing

inserir a descrição da imagem aqui

My code:

import pandas
import os

FileName = 'AiroDumpOutPut'
FileNameCSV = f'{FileName}-01.csv'
Directory = 'Data/Aircrack-ng/'
ExplorePath = os.path.isfile(f'{Directory}{FileNameCSV}')

def OS():
    os.system('cls' if os.name == 'nt' else 'clear')

def Explorer(interface):
    if ExplorePath == True:
        OS()
        os.remove(f'{Directory}{FileNameCSV}')
        os.system(f"sudo airodump-ng -w {Directory}{FileName} --output-format csv {interface}")
        return Decoder()
    else:
        OS()
        os.system(f"sudo airodump-ng -w {Directory}{FileName} --output-format csv {interface}")
        return Decoder()

def Decoder():

    global bssid
    global channel
    global essid
    global encrypt

    CS = pandas.read_csv(f'{Directory}{FileNameCSV}')
    stop_row = CS[CS.BSSID == 'Station MAC'].index[0] -1

    OS()
    df = pandas.read_csv(f'{Directory}{FileNameCSV}', nrows = stop_row)
    df = df.drop(df.columns[[1, 2, 4, 6, 7, 9, 10, 11, 12, 14]], axis=1)
    print(df)
    print()
    ColectedInput = int(input("Please enter the number of the network: "))

    number = 0
    while number < 100:
        if ColectedInput == number:
            #GET THE SELECTED ROW
            out = pandas.read_csv(f'{Directory}{FileNameCSV}', nrows = stop_row)
            out = out.drop(out.columns[[1, 2, 4, 6, 7, 9, 10, 11, 12, 14]], axis=1)
            out = out.iloc[[number]]
            #GET BSSID
            bssid = pandas.read_csv(f'{Directory}{FileNameCSV}', nrows = stop_row)
            bssid = bssid.drop(bssid.columns[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]], axis=1)
            bssid = bssid.iloc[[number]]

            OS()
            print(out)
            print()
            print(f'BSSID: {bssid}')
            #print(f'Channel: {channel}')
            #print(f'ESSID: {essid}')
            #print(f'Encryption: {encrypt}')
        number = number + 1

Basically what I need is to remove the coluna with the number identifying it and the linha what it says BSSID

I hope I’ve cleared up my problem!

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.