Stack Exchange
For row in dataframe, change col "x" to value in col "y" if col "z" == True
In pandas dataframe I want to change column 'beds_baths' to the value of column 'beds_numbers_list' if the value in column 'beds_bool' is equal to 1
My code reads: 

df.loc[df['beds_bool'] > 0, 'beds_baths'] = df.loc[df['beds_numbers_list']]

Here is the error I get

KeyError: 'None of [0    0\n0    1\n0    2\n0    1\n0    4\n0    1\n0    3\n0    1\n0    3\n0    0\n0    2\n0    1\n0    2\n0    1\n0    2\n0    2\n0    1\n0    2\n0    1\n0    4\n0    3\n0    3\n0    2\n0    3\n0    3\n0    2\n0    2\n0    1\n0    1\n0    3\n    ..\n0    1\n0    1\n0    2\n0    1\n0    1\n0    0\n0    6\n0    2\n0    2\n0    2\n0    2\n0    0\n0    2\n0    2\n0    1\n0    2\n0    5\n0    6\n0    6\n0    a\n0    1\n0    2\n0    1\n0    2\n0    0\n0    2\n0    2\n0    3\n0    1\n0    1\nName: beds_numbers_list, Length: 2400, dtype: object] are in the [index]'

Here is a sample of my dataframe
    beds_baths    beds_bool    beds_numbers_list

0   0BR / 1Ba     1            0
 0   1142ft2       0            1
 0   2BR / 1.5Ba   1            2
Column 'beds_baths' should look like this at the end:

beds_baths
  0   0
  0   1142ft2
  0   2


please provide a sample data.

Please see the edit I made to the post.

@OwenMurray, still no sample date. Please read: [mcve].

@OwenMurray, have you read through the above link? How do you suggest we reproduce your problem.

Struggling to format the data into a table

try df.head().to_dict() and pasting the output.

from your first 2 lines i managed to figure out what you want, but in future please follow the above advice.
