I would like to replace entire columns of a pandas dataframe with other columns, for example:
and I would like to replace the columns A and B. What I did is the following:
df['A']=dataFrame['opcodes'].values
df['B']=dataFrame['opt'].values
or also
df['A']=dataFrame['opcodes']
df['B']=dataFrame['opt']
but it does not work. In particular I get the following error:
KeyError: 'opcodes'
in both cases. Can anyone help me? Thank's in advance.
[EDIT] The original dataframe is the following:
on which I did the following modification:
dataFrame['opcodes'] = dataFrame['instructions'].apply(lambda x:[i.split() [0] for i in x])
now I would like to define an other dataframe on which only the 'opt' column and a column with the values 'opcodes' appear.