Hello,
I have two dataframes and would like to know if values from dataframe1 are included in dataframe 2.
My dataframes look something like the following:
'Holidays_he = {'holiday': ['Whit Monday','Epiphany', 'summer vacation', 'summer vacation'],
'date': [datetime.date(2020-06-10),
datetime.date(2020-06-20),
datetime.date(2020-07-01),
datetime.date(2020-07-02)]}
Holidays_he_df = pd.DataFrame(Holidays)
Flights = {'route': ['SXF-STN','SXF-STN','STNSXF','STNSXF'],
'date': [datetime.date(2020-06-11),
datetime.date(2020-06-20),
datetime.date(2020-08-01),
datetime.date(2020-07-02)]}
Flights _df = pd.DataFrame(Flights )
I would now like to create a new column in Flights_df that will output to me in 0's and 1's whether or not there were holidays on the day of the flight.
Thanks in advance for your help.
Sind Werte aus Dataframe1 in Dataframe 2 enthalten?
-
- User
- Beiträge: 491
- Registriert: Mittwoch 13. November 2019, 08:38
Take a look at https://pandas.pydata.org/docs/referenc ... .isin.html.