I read "data.csv" file and has 2 columns.
For "code" columns, I would like to slice the value string and put back only last 2 digit(alphabet) of code into columns.
For each rows, if either "username" and "code" value is missing, I would like to remove the row from the list.
import pandas as pd
df.to_csv("data.csv")
df = pd.read_csv("data.csv", usecols = ['username, 'code'])
print(dt)
What I have now
username code
Chris AB-12-DF
Jake
Rebecca JH-34-TY
LK-49-RT
Expected Output
username code
Chris DF
Rebecca TY