DEV Community

Judy
Judy

Posted on

3 1 1 1 1

Clear duplicate lines and lines having missing values from a csv file #eg24

In the csv file below, some lines have null values, some have NaN values, and there are duplicate lines.

Image description
Use Java to do this: Delete lines containing null values or NaN values, and remove the duplicate lines. Below is the expected result:

Image description
Write the SPL script:

Image description
A1: Parse the csv file as a two-dimensional table.

A2: Convert records of the table to a sequence and perform intersection with [null,NaN] to get records that are not their common members.

A3: Group A2’s records, and get the first record from each group while keeping the original order.

Read How to Call a SPL Script in Java to find how to integrate SPL into a Java application.

Source:https://stackoverflow.com/questions/70806307/how-to-remove-row-which-contains-blank-cell-from-csv-file-in-java

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (1)

Collapse
 
esproc_spl profile image
Judy

SPL open source address:github.com/SPLWare/esProc

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay