import pandas as pd
df = pd.DataFrame({'A':[1,4,3,7], 'B':[3,1,6,4]})
df['diff'] = df['A'] - df['B'].shift()
More Related Contents:
- pygame – How to display text with font & color?
- Difference between numpy.array shape (R, 1) and (R,)
- How to use timeit module
- How to read a text file into a list or an array with Python
- How to save a pandas DataFrame table as a png
- Python Selenium wait for several elements to load
- pandas datetime to unix timestamp seconds
- Run command and get its stdout, stderr separately in near real time like in a terminal
- How to import members of all modules within a package?
- Python – pygame error when executing exe file
- How do I append to a file?
- How do I read from stdin?
- How do I make a time delay? [duplicate]
- How do I remove the first item from a list?
- How to add conda environment to jupyter lab
- A good way to make long strings wrap to newline?
- Good geometry library in python? [closed]
- PyMySQL can’t connect to MySQL on localhost
- Matplotlib: how to make imshow read x,y coordinates from other numpy arrays?
- Python import mechanics
- “Series objects are mutable and cannot be hashed” error
- Interacting with program after execution
- List available font families in `tkinter`
- how to save a pylab figure into in-memory file which can be read into PIL image?
- Lazy logger message string evaluation
- How to find a missing number from a list?
- Redo for loop iteration in Python
- Error: No module named ‘fcntl’
- How to CREATE a transparent gif (or png) with PIL (python-imaging)
- Using interpreter to lookup module ‘sys’ in Python