How to add/subtract values in a dataframe or array column?

I’m going over the array tutorial trying to see how to add 1 to the content of an array but am having difficulties. I do not want to replace the contents of the column by 1, but add 1 to the value already in the column. What is the correct way to do this for an array and dataframe?

QWER = rand(5, 5)

QWER[:,2:4] .+1 #this adds 1 to the selected columns
QWER # but this change does not occur in the array

QWER[:,2:4] .= .+1 # this changes the column values to 1
QWER # this change occurs in the array

using DataFrames
df_QWER = DataFrame(QWER)
df_QWER[:,2:4] = .+1 # this changes the column values to 1
df_QWER # this change occurs in the array

df_QWER = DataFrame(QWER)
df_QWER[:,2:4] .+1 # this adds 1 to the selected columns
df_QWER # but this change does not occur in the array

Try

QWER[:,2:4] .+= 1

This is a shorthand notation for

QWER[:,2:4] = QWER[:,2:4] .+ 1

Thank you!

In a DataFrame, (say, d), and the columns have names, you can just do:

d.my_col .+= 1

you are missing a . like

d.my_col .+= 1

Yes, sorry, fixed.