Issue
I've been struggling with one problem for two days that I have with Python and the Pandas package. I am creating a dataframe with filtered data from another csv and then want to export it to csv again. However, I have a problem because I do not know how to add another value to a specific cell without removing the previous one so that it looks more or less like this in CSV. So that I could add this letter b to the second column and the first row where the letter a already exists
Solution
You can use this code It edits all of the rows if you want else you want to edit just first row you can remove for loop and use i=0
for i in df.index:
if df['B'][i].find('a')>=0:
df['B'][i] += ', b'
Answered By - Ali M
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.