try using apply function.
df['quantity'] = df['quantity'].apply(lambda x: x*-1)
More Related Contents:
- How to deal with SettingWithCopyWarning in Pandas
- How to add a new column to an existing DataFrame?
- why should I make a copy of a data frame in pandas
- What rules does Pandas use to generate a view vs a copy?
- Pandas: Chained assignments [duplicate]
- Pandas: Subindexing dataframes: Copies vs views
- Pandas still getting SettingWithCopyWarning even after using .loc
- Action with pandas SettingWithCopyWarning
- Extracting specific selected columns to new DataFrame as a copy
- Pandas SettingWithCopyWarning [duplicate]
- Checking whether data frame is copy or view in Pandas
- Pandas: Knowing when an operation affects the original dataframe
- Confusion about pandas copy of slice of dataframe warning
- pandas: filter rows of DataFrame with operator chaining
- Pandas groupby: How to get a union of strings
- Applying function with multiple arguments to create a new pandas column
- Python Pandas max value in a group as a new column
- append dataframe to excel with pandas
- How to dynamically update a plot in a loop in IPython notebook (within one cell)
- Why can pandas DataFrames change each other?
- Precision lost while using read_csv in pandas
- Copying MultiIndex dataframes with pd.read_clipboard?
- Get list of pandas dataframe columns based on data type
- pandas.read_csv: how to skip comment lines
- Datetime conversion – How to extract the inferred format?
- Python numpy: cannot convert datetime64[ns] to datetime64[D] (to use with Numba)
- Slicing multiple ranges of columns in Pandas, by list of names
- Pandas groupby and aggregation output should include all the original columns (including the ones not aggregated on)
- Merging two tables with millions of rows in Python
- Pandas data frame to dictionary of lists