cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Hi All, I need to extract rows of dates from a dataframe based on list of values(e.g. dates) located in a CSV file. Can anyone please help me? I have tried groupby function but am not able to get the expected result. Thanks in advance.

SindhuG
New Contributor

my dataframe looks like this.

df =

Datecolumn2column3Machine1-jan-2020A2-jan-2020

-

-

-

A

18-jan-2020

A

11-jan-2020

B

12-jan-2020

B

6-feb-2020C7-feb-2020

-

-

-C14-feb-2020C

Date details csv file looks like this

D =

MachineSelected DateA15-jan-2020C12-feb-2020

I need to pick date and machine from the csv file "D" and in dataframe "df" for that machine, i need to extract the last 3 rows from the 'selected date'.

So Outcome should be

Datecolumn2column3Machine13-jan-2020A14-jan-2020

A15-jan-2020A10-feb-2020C11-feb-2020

C12-feb-2020C

0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group