Here I attached my data frame.I am trying to change specific value of row.but I am not getting succeed.Any leads would be appreciated.
df.replace(to_replace ="Agriculture, forestry and fishing   ", 
             value ="Agriculture") 
Here I attached my data frame.I am trying to change specific value of row.but I am not getting succeed.Any leads would be appreciated.
df.replace(to_replace ="Agriculture, forestry and fishing   ", 
             value ="Agriculture") 
 
    
     
    
    Try this:
df['Name'] = df['Name'].str.replace('Agriculture, forestry and fishing', 'Agriculture')
 
    
    This should work for any data type:
df.loc[df.loc[:, 'Name']=='Agriculture, forestry and fishing', 'Name'] = 'Agriculture'
 
    
    You can easily get all the columns names with calling: df.columns then you can copy this list and replace the name of any column and reassign the list to df.columns. For example:
    import pandas as pd 
    df = pd.DataFrame(data=[[1, 2], [10, 20], [100, 200]], columns=['A', 'B'])
    df.columns
the output will be in a jupyter notebook: Index(['C', 'D'], dtype='object')
so you copy that list and then replace what you want to change and reassign it
    df.columns = ['C', 'D']
and then you will get a dataframe with the name of columns changed from A and B to C and D, you check this by calling
    df.head()
