# Pyspark filter with a column from a different dataframe

**URL:** https://community.openmainframeproject.org/t/pyspark-filter-with-a-column-from-a-different-dataframe/7129
**Category:** Uncategorized
**Created:** [February 16, 2023, 6:37am UTC](https://community.openmainframeproject.org/t/pyspark-filter-with-a-column-from-a-different-dataframe/7129 "2023-02-16T06:37:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![samuel321](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@samuel321](https://community.openmainframeproject.org/u/samuel321)
#### Post date: [February 16, 2023, 6:37am UTC](https://community.openmainframeproject.org/t/pyspark-filter-with-a-column-from-a-different-dataframe/7129/1 "2023-02-16T06:37:28Z")

</div>

I would like to filter Id from price where exist in events data frame. My code is below but it is not working in pyspark. How am I going to fix this?

```auto
events = spark.createDataFrame([(657,'Conferences'),
                          (765, 'Seminars '),
                          (776, 'Meetings'),
                          (879, 'Conferences'),
                          (765, 'Meetings'),
                          (879, 'Seminars'),
                          (985, 'Meetings'),
                          (879, 'Meetings'),
                          (657, 'Seminars'),
                          (657,'Conferences')]
                         ,['Id', 'event_name'])
events.show()
price = spark.createDataFrame([(657,10),
                          (879,45),
                          (776,54),
                          (879,45),
                          (765, 65)]
                         ,['Id','Price'])

price[price.Id.isin(events.Id)].show()

```
