How to grab only certain sections of data from a csv file

King Java 790 Reputation points
2023-09-07T23:24:37.4766667+00:00

I am trying to grab certain rows (and columns) of data from csv file.

As you can see below, I am trying to grab only certain rows and columns of data from csv file (two spots).

What is best solution?

User's image

Should I use Python script to run or is there a better/quicker way in ADF?

Thanks.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
{count} votes

Accepted answer
  1. Sina Salam 22,031 Reputation points Volunteer Moderator
    2023-09-08T03:45:53.47+00:00

    Hello @King Java

    Welcome to Microsoft Q&A and thank you for posting your questions here.

    Concerning your question, you were asking if you should use Python script to run it or use your Azure Data Factory (ADF) better or quicker way.

    Absolutely, you can use Python. However, to grab specific sections of data from a CSV file using Azure Data Factory (ADF), because of Azure ecosystem Azure Data Factory (ADF) is a powerful tool to consider, very fast and easy. It allows you to create data pipelines and perform Extract, Transform, Load (ETL) operations on various data sources, including CSV files.

    Therefore, if all your configurations are okay, while adding Data Flow Transformations or after you can do the followings:

    • Inside the Data Flow activity, add transformations to filter rows and select specific columns.
      • You can use the Filter and Select transformations for this purpose for example, to filter rows where the 'Role' column is 'Manager' and select specific columns like 'Name' and 'Salary', you would configure these transformations to your specific needs accordingly.
    • You can define filter conditions using expressions in the Filter transformation.
    • Then, after applying the transformations, configure the Sink dataset. This dataset defines where the filtered and selected data will be written. You can specify the path, format, and destination for the output CSV file.

    I hope this is helpful! PS: Do not hesitate to let me know if you have any other questions.

    Please remember to "Accept Answer" if answer helped, so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.