Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

dataframe change specicf values in column

df['column name'] = df['column name'].replace(['old value'],'new value')
Comment

dataframe change column value

df["column1"].replace({"a": "x", "b": "y"}, inplace=True)
Comment

change value in dataframe

# change value in column_where_to_change and in the row where column_name == column_value
df.loc[df['<column_name>']=='column_value', '<column_where_to_change>'] = '<new_value>'
Comment

PREVIOUS NEXT
Code Example
Python :: trimming spaces in string python 
Python :: gamestop 
Python :: timed loop python 
Python :: pygame mute import message 
Python :: python exe not working on other pc 
Python :: rightclick in pygame 
Python :: Add a quit button Tkinter 
Python :: make first row column names pandas 
Python :: pandas change every row to df 
Python :: python download s3 image 
Python :: get current time python 
Python :: convert int to hex binary in python 
Python :: Get all columns with particular name in string 
Python :: pyspark groupby sum 
Python :: exit all threads from within a thread python 
Python :: scaling image interpolation python 
Python :: python merge two dictionaries 
Python :: how to reverse a list in python 
Python :: RuntimeWarning: invalid value encountered in true_divide 
Python :: autopy in python install 
Python :: python string contains substring 
Python :: python for loop max iterations 
Python :: discord get author slash command 
Python :: update python mac 
Python :: how to import .csv file in python 
Python :: print var python 
Python :: check object attributes python 
Python :: Example XlsxWriter in Python 
Python :: pandas read_csv nan as empty string 
Python :: python dictionary to csv 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =