I have a csv file that contains hundreds of images path and text file path with different extensions. Now i want to find the unique extension of these images and text files. How do i do that? eg of data contained in csv file:
images_path:
https://img.sportstars.id/2021/07/h4bc44/master_B7Nrz3845M_1077.JPG
https://img.sportstars.id/2021/04/M17c3d/master_04fdj7Zi27_1560.jpg
https://img.sportstars.id/2021/07/j6KY90/master_9uYf5T2Y97_1940.jpg
text_path:
xNeW1g.txt
YnENun.txt
tstaxy.txt
Note: both text and image path are contained in same csv as column names. Please any help would be appreciated. Thanks
CodePudding user response:
Use @tzinie's solution:
df['images_extensions'] = df['images_path'].apply(lambda x: os.path.splitext(x)[-1])