# Easy method to subtract all the columns from one reference column .Sum and square it and store it

Whether to compare by the index (0 or ‘index’) or columns (1 or ‘columns’), For Series input, axis to match Series index on

```
>>> df = pd.DataFrame({
'angles': [0, 3, 4],
...'degrees': [360, 180, 360]
},
...index = ['circle', 'triangle', 'rectangle']) >>>
df
angles degrees
circle 0 360
triangle 3 180
rectangle 4 360
```

As you may remember from a math course, subtracting a negative number is the same as adding it, So, make all the numbers you want to subtract negative (for this, simply type a minus sign before a number), and then use the SUM function to add up the negative numbers:,As an example, let's subtract numbers in column C from the numbers in column B, beginning with row 2:,Select a range of empty cells that has the same number of rows and columns as your matrices

= 100 - 10

Once you learned how to subtract cells with a formula, subtracting columns is a breeze, The easiest way to do so is to drag the fill handle from the cell you’ve applied the formula down to the last row of that column

`[cell reference] - TIME(N hours, 0, 0).`

I need to easy method to do this, Maybe a small function

```
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
df = pd.read_csv('F:\\Python\\projects\\testdrivingcycles.csv', usecols = ['position', 'ReferenceSpeed', 'speed1', 'speed2', 'speed3', 'speed4', 'speed5', 'speed6', 'speed7', 'speed8', 'speed9', 'speed10'])
dict1 = np.square(df.loc[: , 'ReferenceSpeed': ].subtract(df.ReferenceSpeed, axis = 0).sum()).to_dict()
print(dict1)
```

#### Other "method-column" answers related to "Easy method to subtract all the columns from one reference column .Sum and square it and store it"

- WindowsError: [Error 2] The system cannot find the file specified, Python 2.7
- How to allow notifications on headless chrome using selenium webdriver
- Understanding Scapy's sniffer
- Run spicy.stats ANOVA test for all unique values in a data frames column?
- All sub-arrays with sum less than X and greater than Y
- Detect rectangle in image and crop
- Why there is difference in count of rows in dataframe when reading CSV from SaS and Python?
- Out of sample prediction/forecasting for uni-variate time series in Keras
- Static file directory not found (heroku)
- List index out of range in a merge and sort function
- Jupyter notebook kernel constantly needs to be restarted
- Generate a deterministic set of values from non-uniform distributions
- Read multiple datasets from same Group in h5 file using h5py
- Why is it not possible to implement fixed-point combinator like in the definition?
- When launch pgAdmin 4 says: The pgAdmin 4 server could not be contacted:
- Why do both inputs change when I'm just changing one in tkinter? [duplicate]
- Why is 4.1 - 3.0 = 1.0999999999999996 in python? [duplicate]
- Write a program that asks the user to type in 5 numbers , and that outputs the largest of these numbers and the smallest of these numbers
- What is the max length of a Python string?
- Encountering ModuleNotFoundError: No module named 'matplotlib' although # All requested packages already installed