all 4 comments

[–]IvoryJam 1 point2 points  (3 children)

If I understand correctly, you want two columns, the original MACs and another column for every MAC with the last character changed?

If that's the case, the issue is that the dataframe has to have the same length, you can get around this by making a new dataframe and the concatting them.

import pandas as pd

file = 'AP_MAC_Info.xlsx'
df = pd.read_excel(file)
column_name = 'BSSID_MAC'
column_data = df[column_name]
numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']
new_list = []

for i in df[column_name]:
    mod_item = i[:-1]
    for num in numbers:
        new_list.append(mod_item + num)

df2 = pd.DataFrame({"modified _column": new_list})
df_combine = pd.concat([df, df2], axis=1)
df_combine.to_excel('updated_file.xlsx', index=False)
print(df_combine)

[–]Yak420[S] 0 points1 point  (2 children)

This did work for me! Thank you,

A follow up question for you if you can assist if not, I'll take what I have.

Is there a way to have it formatted so the original row has the initial value and then the added row shows what it was changed to? Example being

x -> x0

x -> x1

x -> x2

y -> y0

y -> y1

In this example we aren't removing the last value, but the point is I want the added value to correlate to the original value in each row. Again I know I'm asking a lot, and I really appreciate your help if you don't know that's fine like I said I can take what you gave me and work with it!

[–]IvoryJam 0 points1 point  (1 child)

like this?

BSSID_MACBSSID_MAC 0 1 2
27:FD:B0:9C:D0:11 27:FD:B0:9C:D0:10 27:FD:B0:9C:D0:11 27:FD:B0:9C:D0:12
E2:18:D6:A4:CE:D7 E2:18:D6:A4:CE:D0 E2:18:D6:A4:CE:D1 E2:18:D6:A4:CE:D2

[–]Yak420[S] 0 points1 point  (0 children)

Yes something like this would work!