This should do it for you:

# Find the name of the column by index
n = df.columns[1]

# Drop that column
df.drop(n, axis = 1, inplace = True)

# Put whatever series you want in its place
df[n] = newCol

...where [1] can be whatever the index is, axis = 1 should not change.

This answers your question very literally where you asked to drop a column and then add one back in. But the reality is that there is no need to drop the column if you just replace it with newCol.

Answer from elPastor on Stack Overflow
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.replace.html
pandas.DataFrame.replace — pandas 3.0.5 documentation
Value to replace any values matching to_replace with. For a DataFrame a dict of values can be used to specify which value to use for each column (columns not in the dict will not be filled). Regular expressions, strings and lists or dicts of such objects are also allowed.
Discussions

Replacing certain values from entire columns of a pandas dataframe
Use the map method https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.map.html More on reddit.com
🌐 r/learnpython
2
1
June 28, 2021
python - pandas replace values of a list column - Stack Overflow
Agreed! this worked even if Feeback column is not a list. You also addressed the other problem with my feedback_dict dictionary, numbers should be encapsulated as strings to avoid errors. Then, we can do this --> data.replace(feedback_dict, regex=True) More on stackoverflow.com
🌐 stackoverflow.com
python - Replace list element in pandas dataframe - Stack Overflow
Here I got TypeError. I want to replace specific lists and there is no any regulation between the list which is to be replaced and the object used to replace the list. ... This is not a trivial problem, because DataFrames are not designed to work with mutable objects like lists, sets, or dicts. More on stackoverflow.com
🌐 stackoverflow.com
python - how to replace an entire column on Pandas.DataFrame - Stack Overflow
I would like to replace an entire column on a Pandas DataFrame with another column taken from another DataFrame, an example will clarify what I am looking for import pandas as pd dic = {'A': [1, 4,... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Vultr Docs
docs.vultr.com › python › third-party › pandas › DataFrame › replace
Python Pandas DataFrame replace() - Replace Values | Vultr Docs
December 27, 2024 - The rest of the DataFrame remains unchanged. Prepare a DataFrame with several integers. Use replace() to swap a list of values with another list. ... Here, 1 is replaced by 11 and 3 by 33 across the entire DataFrame.
🌐
Note.nkmk.me
note.nkmk.me › home › python › pandas
pandas: Replace values in DataFrame and Series with replace() | note.nkmk.me
January 17, 2024 - print(df.replace('CA', 'California')) # name age state point # 0 Alice 24 NY 64 # 1 Bob 42 California 24 # 2 Charlie 18 California 70 # 3 Dave 68 TX 70 # 4 Ellen 24 California 88 # 5 Frank 30 NY 57 ... All columns' values are replaced.
🌐
Pandas
pandas.pydata.org › pandas-docs › version › 2.1.4 › reference › api › pandas.DataFrame.replace.html
pandas.DataFrame.replace — pandas 2.1.4 documentation
Value to replace any values matching to_replace with. For a DataFrame a dict of values can be used to specify which value to use for each column (columns not in the dict will not be filled). Regular expressions, strings and lists or dicts of such objects are also allowed.
🌐
IncludeHelp
includehelp.com › python › how-to-replace-an-entire-column-on-pandas-dataframe.aspx
How to replace an entire column on pandas dataframe?
If we want to replace with the ... that we want to replace. For this purpose, we can simply replace the column by accessing the column using square brackets with DataFrame like df[col]. After doing this, we will copy all the conten...
Find elsewhere
🌐
Data to Fish
datatofish.com › replace-values-pandas-dataframe
How to Replace Values in a pandas DataFrame
# replace one specific value in a column df['column_a'] = df['column_a'].replace("x", "y") # replace multiple values (x, y) with one value (z) in a column df['column_a'] = df['column_a'].replace(["x", "y"], "z") # replace values (w, x) with other values (y, z) in a column df['column_a'] = df['column_a'].replace(["w", "x"], ["y", "z"]) # replace one specific value in the entire df df = df.replace("x", "y") ... That's it! You just learned how to replace values in a pandas DataFrame.
🌐
datagy
datagy.io › home › pandas tutorials › pandas dataframes › pandas replace() – replace values in pandas dataframe
Pandas replace() - Replace Values in Pandas Dataframe • datagy
March 2, 2023 - Learn how to use the Pandas replace method to replace values across columns and dataframes, including with regular expressions.
🌐
Iditect
iditect.com › faq › python › how-to-replace-an-entire-column-on-pandasdataframe.html
How to replace an entire column on Pandas.DataFrame
import pandas as pd # Example DataFrame df = pd.DataFrame({'A': [1, 2, 3, 4, 5]}) # Constant value for replacement constant_value = 10 # Replace column 'A' with the constant value df['A'] = constant_value print(df) "Pandas DataFrame set column values to zero" Description: This query involves setting all values in a Pandas DataFrame column to zero.
🌐
Edureka Community
edureka.co › home › community › categories › python › how to replace entire column in pandas dataframe
How to replace entire column in pandas dataframe | Edureka Community
May 8, 2019 - How to replace entire column in pandas dataframe · Reading different format files from s3 having decoding issues using boto3 May 17, 2024 · What is the algorithm to find the sum of prime numbers in the input in python Feb 22, 2024 · How to Concatenate Lists in Python?
🌐
Towards Data Science
towardsdatascience.com › home › latest › how to replace values in pandas
How to Replace Values in Pandas | Towards Data Science
January 16, 2025 - The method also accepts lists or nested dictionaries, in case you want to specify columns where the changes must be made or you can use a Pandas Series using df.col.replace(). ... # Replace with nested dictionariesdf.replace({ 'payment': {'cash':0, 'credit card': 1}, 'pickup_borough': {'Manhattan': 'island'} })
🌐
pandas
pandas.pydata.org › pandas-docs › dev › reference › api › pandas.DataFrame.replace.html
pandas.DataFrame.replace — pandas 3.1.0.dev0 documentation
Value to replace any values matching to_replace with. For a DataFrame a dict of values can be used to specify which value to use for each column (columns not in the dict will not be filled). Regular expressions, strings and lists or dicts of such objects are also allowed.
🌐
GeeksforGeeks
geeksforgeeks.org › data analysis › python-pandas-dataframe-replace
Python | Pandas dataframe.replace() - GeeksforGeeks
Pandas dataframe.replace() function is used to replace a string, regex, list, dictionary, series, number, etc. from a Pandas Dataframe in Python.
Published: July 11, 2025
🌐
Python Guides
pythonguides.com › pandas-replace-multiple-values
Replace Multiple Values In Pandas DataFrame Using Str.Replace()
May 22, 2025 - Python replace() method is the simplest way to replace multiple values in a Pandas DataFrame. Here’s a simple example with US state abbreviations:
🌐
Spark By {Examples}
sparkbyexamples.com › home › pandas › pandas dataframe replace() – by examples
Pandas DataFrame replace() - by Examples - Spark By {Examples}
October 10, 2024 - pandas.DataFrame.replace() function is used to replace values in columns (one value with another value on all columns). It is a powerful tool for data