I’m not answering your question… Just giving you a better work around.
Use to_series()
them map
df = pd.DataFrame({'one': {'A': 10, 'B': 20, 'C': 30, 'D': 40, 'E': 50}})
map_dict = {'A': 'every', 'B': 'good', 'C': 'boy', 'D': 'does', 'E': 'fine'}
df['two'] = df.index.to_series().map(map_dict)
df
one two
A 10 every
B 20 good
C 30 boy
D 40 does
E 50 fine
Related Contents:
- How to group dataframe rows into list in pandas groupby
- Conditional Replace Pandas
- Convert a Pandas DataFrame to a dictionary
- In pandas, is inplace = True considered harmful, or not?
- Replacing blank values (white space) with NaN in pandas
- How to replace text in a string column of a Pandas dataframe?
- Best way to join / merge by range in pandas
- Pandas dataframe get first row of each group
- Pandas DataFrame to List of Dictionaries
- Convert Column to Date Format (Pandas Dataframe)
- Pretty Printing a pandas dataframe
- Find column name in pandas that matches an array
- How to check if any value is NaN in a Pandas DataFrame
- How to calculate mean values grouped on another column in Pandas
- Pandas Timedelta in Days
- Progress indicator during pandas operations
- Pandas DataFrame concat vs append
- How to insert pandas dataframe via mysqldb into database?
- Dropping infinite values from dataframes in pandas?
- Pandas: Cast column to string does not work
- How to concatenate two dataframes without duplicates?
- Constructing a co-occurrence matrix in python pandas
- Python: Random selection per group
- Pandas DataFrame column to list [duplicate]
- Suppressing scientific notation in pandas? [duplicate]
- How to plot multiple dataframes in subplots
- Create a day-of-week column in a Pandas dataframe using Python
- Combining two Series into a DataFrame in pandas
- Return multiple columns from pandas apply()
- Get first row value of a given column
- Putting many python pandas dataframes to one excel worksheet
- pd.Timestamp versus np.datetime64: are they interchangeable for selected uses?
- Extract string from a dataframe comparing to a list
- How to use Pandas rolling_* functions on a forward-looking basis
- What techniques can be used to measure performance of pandas/numpy solutions
- How can repetitive rows of data be collected in a single row in pandas?
- Merging two dataframes based on a date between two other dates without a common column
- No numeric types to aggregate – change in groupby() behaviour?
- Select row by max value in group in a pandas dataframe
- Seaborn ValueError: zero-size array to reduction operation minimum which has no identity
- How to drop unique rows in a pandas dataframe?
- LabelEncoder: TypeError: ‘>’ not supported between instances of ‘float’ and ‘str’
- Split pandas dataframe in two if it has more than 10 rows
- Pandas Dataframe Find Rows Where all Columns Equal
- plotting a histogram on a Log scale with Matplotlib
- Pandas get the age from a date (example: date of birth)
- Loading multiple csv files of a folder into one dataframe
- Pythonic/efficient way to strip whitespace from every Pandas Data frame cell that has a stringlike object in it
- Sorting by absolute value without changing the data
- How to convert R dataframe back to Pandas using rpy2?