In [18]: a
Out[18]:
x1 x2
0 0 5
1 1 6
2 2 7
3 3 8
4 4 9
In [19]: a['x2'] = a.x2.shift(1)
In [20]: a
Out[20]:
x1 x2
0 0 NaN
1 1 5
2 2 6
3 3 7
4 4 8
More Related Contents:
- error when applying function to a series object
- Groupby value counts on the dataframe pandas
- Using Pandas to pd.read_excel() for multiple worksheets of the same workbook
- How to add pandas data to an existing csv file?
- How to explode a list inside a Dataframe cell into separate rows
- How to print pandas DataFrame without index
- How to map numeric data into categories / bins in Pandas dataframe
- Normalize columns of pandas data frame
- How do I sum values in a column that match a given condition using pandas?
- How to loop over grouped Pandas dataframe?
- Update a dataframe in pandas while iterating row by row
- Is there a simple way to change a column of yes/no to 1/0 in a Pandas dataframe?
- Conditionally format Python pandas cell
- How to concatenate multiple column values into a single column in Pandas dataframe
- How to create a dictionary of two pandas DataFrame columns
- How can I use cumsum within a group in Pandas?
- Pandas dataframe – running sum with reset
- What is dtype(‘O’), in pandas?
- Why does df.apply(tuple) work but not df.apply(list)?
- Merge a list of pandas dataframes
- Checking if particular value (in cell) is NaN in pandas DataFrame not working using ix or iloc
- Move column by name to front of table in pandas
- Convert List to Pandas Dataframe Column
- How to repeat a Pandas DataFrame?
- Get column name where value is something in pandas dataframe
- dataframe to dict such that one column is the key and the other is the value [duplicate]
- Is there a way to speed up handling large CSVs and dataframes in python?
- What values are valid in Pandas ‘Freq’ tags?
- How to convert DataFrame.append() to pandas.concat()?
- How to efficiently assign unique ID to individuals with multiple entries based on name in very large df