0

I am new to Pandas and already spent a good few hours on videos and websites getting familiar with this python library. I would appreciate some help with this issue I am working on; I am using one column from a dataframe(df1) to look up a matching entry in a column of dataframe (df2). An entry in a cell (df1) could be 'Advanced Automation Co.' that would be the same entity in column of df2 'Advanced Automation' - missing the Co. I'd like to iterate where I start with the complete string (Advance Automation Co.' and if I do not find an exact match I use the first two words. Thank you.

I have tried slice() to pick the words I need from column in df1 but I cannot isolate the 'slice' I need as a variable to pass on to the search code.

  • Synthesize a truncated company name column. Now df1 & df2 have something you can do exact string match on. Use [merge](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.merge.html) to produce a single wider dataframe from both. – J_H Dec 16 '22 at 16:22
  • See if this Q&A (https://stackoverflow.com/questions/74695019/how-do-i-merge-two-csv-files-and-retain-all-columns-and-rows-with-python-pandas/74719235#74719235) helps – crashMOGWAI Dec 16 '22 at 16:29

0 Answers0