Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 2 excel Files
File1= 2 COlumns namely: Reference Number and Vehicle Applications

Reference Number Vehicle Applications
XYZ111 Polo, Golf, BMW
ABC222 Golf, BMW
File2= 2 Columns namely: Car Model and Total Sales

Car Model Total Sales
Polo 500
Golf 1000
BMW 100


I am trying to find which car models from File2 are present in vehicle applications of File1 and if present I want to calculate total sales.
For Eg: In first row of File1: Polo and Golf are present then next to it I need calculation of sales which would be Golf Sales+Polo Sales=1500

What I have tried:

I have tried importing the library re to find the values and sub strings.

Please note, I am new to Python
Posted
Updated 7-Feb-23 23:10pm
Comments
bhrigwish 8-Feb-23 5:33am    
I have imported the file using Pandas. I have done if else on sub strings and also tried using re library. But I am not getting anywhere

1 solution

You cannot read Excel files as simple strings. I would suggest you start by studying Python: The Python Tutorial — Python 3.10.9 documentation[^]. You can then look at the openpyxl - A Python library to read/write Excel 2010 xlsx/xlsm files — openpyxl 3.1.0 documentation[^] package, to see how to do it.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900