Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14389

How can I change data in pandas dataframe by condition?

$
0
0

I need convert pandas dataframe.

I have dataframe:

data10SGD01|AA169|10SGD01|AA170

I need to get:

data10SGD01AA169|10SGD01AA170

I try:

df['data'] = df['data'].str.replace('|(?=AA)', '', regex=True)

This regex does not work. Where is the mistake?

Version of pandas == 2.0.3


Viewing all articles
Browse latest Browse all 14389

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>