Skip to content
Advertisement

Python. Pandas. Merge

I have written a code that merges File B into File A based on a column ‘Code’. Some of the values from File B, however, are generic (‘Color’) and I would need to do another merge with file C – but instead of creating a new column I would like to use the same column created during the first merge and whenever first merge returned value ‘Color’ only for those rows do merge with file C to get the proper value.

I went as far as merging A with B:

JavaScript

Would anyone have any idea where do I even start, please?

enter image description here

Advertisement

Answer

Try :

JavaScript

Output

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement