user13373167
user13373167

Reputation:

Failing: Performing addition to a data frame and storing it in a data frame

I am trying to add some constant values to a data frame.

I have successfully done multiplication, but now addition does not work.

This works:

df_C2H_TT_y1['DURATION_H'] = df_C2H_TT_y1['DURATION_H'] * 0.95

This does not work:

TT_Base = pd.DataFrame
TT_Base["TT"] = (0.05 + A2C_TT_x2['DURATION_H']) + 0.25 + df_C2H_TT_y1['DURATION_H'] + 0.58333333333333333333333333333333)
TT_Base

This is an error: 'type' object does not support item assignment

What is wrong here?

Upvotes: 0

Views: 26

Answers (1)

Hanna
Hanna

Reputation: 91

You need to create a dataframe by adding parenthesis:

TT_Base = pd.DataFrame()

Upvotes: 1

Related Questions