generate functionFri, 14 Apr 2023

with pandas read a csv named test1.csv then extract column named resourcesAffected.s3Bucket.tags and loop through each value and extract every text found it after ': ' and stop in the next 'ñ' and print

import pandas as pd def extract_tag(tag): start = tag.find(': ') end = tag.find('ñ') if (start > -1) & (end > -1): t = tag[start + 2:end] return t def main(): df = pd.read_csv('test1.csv') df.resourcesAffected.s3Bucket.tags.apply(extract_tag) if __name__ == '__main__': main()

Questions about programming?Chat with your personal AI assistant