I have a data table:
sample_data = {'Sample': ['A', 'B', 'A', 'B'],
'Surface': ['Top', 'Bottom', 'Top', 'Bottom'],
'Intensity' : [21, 32, 14, 45]}
sample_dataframe = pd.DataFrame(data=sample_data)
I would like to add user input to create a column 'Condition' based on the 'Sample' column. The function below returns the error "TypeError: 'DataFrame' object is not callable"
def get_choice(df, column):
for i in column:
user_input = input('Condition= ')
df['Condition'] = df(user_input)
return df
get_choice(sample_dataframe, 'Sample')
['Sample', ]instead of'Sample'?