有下面一个dataframe
dataframe:
a b
0 cm1 b1-name xxxx
1 cm2 name yyyy
2 cm3 b3-name name zzzz
想在b列的每个字符串前后都加上!A!:
a b
0 cm1 !A!b1-name xxxx!A!
1 cm2 !A!name yyyy!A!
2 cm3 !A!b3-name name zzzz!A!
请问该如何实现?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
for i in range(len(s_list)):
for j in range(len(s_val)):
str = '!TAB!' + ' '.join(s_val[j].split()).replace(' ','!TAB!') + '!TAB!'
df['b'][j] = str
s_idx = df[df['b'].str.contains('!TAB!' + s_list[0] + '!TAB!') == True].index.values
print(s_idx)