I have a sample dataframe:
Id Age Name
0 0110 23 Max
1 2009 56 Stan
2 1167 25 Joy
3 8878 44 Lee
at present for the input dataframe I'm using
dfnew = df.drop(df.columns.difference(['Id']),1)
to drop unwanted column(i.e Id) in dataframe and proceeding ahead. Which is correct but there are two dataframes.
is there anyway we can optimise it?
while converting the dataframe to a list can we have only age and name in the list and ignore Id like lst = [[23,Max],[56,stan]....]
please assist on this. Thank you.
df[["Age", "Name"]].apply(list, axis=1).tolist()ORdf.drop("Id", axis=1).apply(list, axis=1).tolist()?