To replace current values with different values dynamically, replace is very helpful.
To demonstrate this, if you wanted to replace the zeroes and ones in the current dataset with boolean values, true or false, you could do this using replace.
In df, replace 0 with False and 1 with True.
Store this output in df_bool.
Extracted text: To replace current values with different values dynamically, replace is very helpful. To demonstrate this, if you wanted to replace the zeroes and ones in the current dataset with boolean values, true or false, you could do this using replace. In df , replace o with False and 1 with True . Store this output in df_bool. In [ ]: # YOUR CODE HERE df bool = In [ ]: assert df_bool.shape df.shape == assert df_bool.loc[1,'chocolate'] assert df_bool.iloc[0,0] assert type (df_bool.loc[1,'chocolate']) != np.int64 True == '100 Grand' In [ ]: df_bool
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here