0

So I have table 1 which is the properties I own

and I have table 2 the tables of government database

table 1: 1 john street, 2 john street, 3 john street, 4 john street

table 2: 1 Clive Street, 2 john street, 2 fred street, 4 john street

I WANT A TABLE WHICH PROVIDES THE COMMON PROPERTIES:

Desired output table: 2 John street, 4 John Street

How can I achieve this with a merge on Pandas?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Alex B
  • 21
  • 5
  • 1
    Python doesn't have "tables" or "dataframes". Please remember to use the [tag:pandas] tag when asking about Pandas. – ChrisGPT was on strike Aug 21 '20 at 16:47
  • Does this answer your question? [Pandas - intersection of two data frames based on column entries](https://stackoverflow.com/questions/26921943/pandas-intersection-of-two-data-frames-based-on-column-entries) – Gergely Aug 21 '20 at 16:53

1 Answers1

0
s=pd.merge(table1,table2,on='john street', how='left')

if you want just these two columns, you can do that:

df1 = pd.DataFrame(s, columns = ['john street', 'john street'])