Question: I have a pearson correlation results of a specific columns of a csv:

```
cleanlist = df.iloc[:, [7,8,9,10,11,12]]
pearsoncorr = cleanlist.corr(method='pearson')

```

I want to know how to print only the values that are >= 0.01, and eliminate those that are smaller of a pearson correlation result.

Thanks for reading!

Answer: 
You can use **Spring JPA Projection** for this. You can find a nice tutorial by Baeldung [here](https://www.baeldung.com/spring-data-jpa-projections), to learn how it works.

In your case, `Persons` is your ***projection class***, so it **should not be an entity** and **should not have its own repository**.

The way projections work is through constructors of projection classes (like `Persons` class). You should create a constructor on Person with the fields you want to get in the query. Your `Persons` entity should look like this

```
public class Persons implements Serializable {

    private Long count;

    public Person(Long count) {
        this.count = count;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }
}

```

Then, when you want to fetch `Persons` data from X entity, you can call the constructor of Persons to create `Persons` object from the fields of `X`. You will have the following on your `XRepository.java`:

```
@Repository
public interface XRepository extends JpaRepository<X, Long> {

    @Query("SELECT new com.your.package.Persons(count(x)) FROM X x WHERE x.id in your_subquery")
    public Persons persons();
}

```
Maybe you can add the formula annotation in your entity:

```
    @Formula("(SELECT count(*) FROM person_table)")
    private long count;

```

But you need a table for your entity.
Example:

```

@Data
@Entity
@Table(name = "person_table")
public class Person implements Serializable {

    private static final long serialVersionUID = -2860883647884316002L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Formula("(SELECT count(*) FROM person_table)")
    private long count;
}

```