How about:
df['new_col'] = range(1, len(df) + 1)
Alternatively if you want the index to be the ranks and store the original index as a column:
df = df.reset_index()
Related Contents:
- How are iloc and loc different?
- How to convert index of a pandas dataframe into a column
- Selecting a row of pandas series/dataframe by integer index
- How to reset index in a pandas dataframe? [duplicate]
- Get column index from column name in python pandas
- pandas: multiple conditions while indexing data frame – unexpected behavior
- Python Pandas: Get index of rows where column matches certain value
- What rules does Pandas use to generate a view vs a copy?
- Pandas split DataFrame by column value
- Apply Function on DataFrame Index
- Forcing pandas .iloc to return a single-row dataframe?
- start index at 1 for Pandas DataFrame
- Accessing Pandas column using squared brackets vs using a dot (like an attribute)
- Select only one index of multiindex DataFrame
- pandas – change df.index from float64 to unicode or string
- Pandas – Compute z-score for all columns
- In Python pandas, start row index from 1 instead of zero without creating additional column
- Set MultiIndex of an existing DataFrame in pandas
- Accessing a Pandas index like a regular column
- obtaining last value of dataframe column without index
- Delete a column from a Pandas DataFrame
- How do I get the row count of a Pandas DataFrame?
- How to change the order of DataFrame columns?
- How to add a new column to an existing DataFrame?
- Convert Python dict into a dataframe
- How do I create test and train samples from one dataframe with pandas?
- Convert a Pandas DataFrame to a dictionary
- Detect and exclude outliers in a pandas DataFrame
- Concatenate a list of pandas dataframes together
- Python Pandas – Find difference between two data frames
- Python Pandas replace NaN in one column with value from corresponding row of second column
- How to convert a dataframe to a dictionary
- Update row values where certain condition is met in pandas
- How to read a Parquet file into Pandas DataFrame?
- Joining pandas DataFrames by Column names
- Python: get a frequency count based on two columns (variables) in pandas dataframe some row appers
- Difference between groupby and pivot_table
- Convert pandas DataFrame into list of lists [duplicate]
- How to repeat a Pandas DataFrame?
- Data type conversion error: ValueError: Cannot convert non-finite values (NA or inf) to integer [duplicate]
- USING LIKE inside pandas.query()
- How to query MultiIndex index columns values in pandas
- How to get/set a pandas index column title or name?
- Pythonic/efficient way to strip whitespace from every Pandas Data frame cell that has a stringlike object in it
- Check if all values in dataframe column are the same
- How do I transpose dataframe in pandas without index?
- How to convert list to row dataframe with Pandas
- Python pandas groupby aggregate on multiple columns, then pivot
- Count number of elements in each column less than x
- Split pandas dataframe in two if it has more than 10 rows