I have a CSV file which contains many columns for payments.
There's one column column called control_number. This is unique identifier for every transaction and it follows a pattern, all control numbers must.
Starts with 991 and contains 12 digits. Now, I want to extract list of all control numbers that do not follow a pattern.
Sample data:
| control_number |
|---|
| 991100267615 |
| 991100267632 |
| 991100267636 |
| 992100267635 |
| 991100267672 |
| 991100267697 |
| 995100267696 |
| 991100267726 |
| 991100267743 |
| 991100267761 |
| 991100267771 |
| 990100267779 |
| 991100267768 |
| 991100267811 |
| 991100267813 |
| 991100267814 |
Desired output should be like this:
| control_number |
|---|
| 992100267635 |
| 995100267696 |
| 990100267779 |
Here's what I have so far:
import pandas as pd
import re
import numpy as np
df = pd.read_csv("transactions.csv")
df.head(5)
invalid_transaction = df['control_number']
re.findall(r"(?<!\d)\d{5}(?!\d)", invalid_transaction)