# How to delete the columns of a dataframe that have only positive values?

**URL:** <https://discourse.julialang.org/t/how-to-delete-the-columns-of-a-dataframe-that-have-only-positive-values/65922>\
**Category:** General Usage\
**Tags:** question, dataframes\
**Created:** [August 6, 2021, 2:43am UTC](https://discourse.julialang.org/t/how-to-delete-the-columns-of-a-dataframe-that-have-only-positive-values/65922 "2021-08-06T02:43:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vzehnder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vzehnder/32/27595_2.png) [@Vzehnder](https://discourse.julialang.org/u/Vzehnder)\
**Post date:** [August 6, 2021, 2:43am UTC](https://discourse.julialang.org/t/how-to-delete-the-columns-of-a-dataframe-that-have-only-positive-values/65922/1 "2021-08-06T02:43:49Z")

</div>

I’m trying to edit a DataFrame, my objective is to keep the columns in which at least one value is \<=0.

For example, using the code

```julia
using DataFrames

data = Dict("A"=>[1,7,2], 
    "B"=>[3,-9,-3], 
    "C"=>[3,0,6], 
    "D"=>[8,4,2], 
    "E"=>[4,3,-4])

df = DataFrame(data)

```

I get the following result

![df1](https://global.discourse-cdn.com/julialang/original/3X/c/5/c5c242b9732a65d3a6c6dbb6490873e7427e2b8f.jpeg)

And I’m trying to transform it into the following DataFrame

![df2](https://global.discourse-cdn.com/julialang/original/3X/e/5/e553aacafcdd61fa8ee03d98739e895e049d50c9.jpeg)

There are some options to remove rows based on conditions, but I haven’t found any that does the same to columns.

Does anyone know how to do this in a simple way?

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [August 6, 2021, 5:06am UTC](https://discourse.julialang.org/t/how-to-delete-the-columns-of-a-dataframe-that-have-only-positive-values/65922/2 "2021-08-06T05:06:32Z")

</div>

I have answered on StackOverflow here:

[https://stackoverflow.com/questions/68675457/how-to-delete-the-columns-of-a-dataframe-that-have-only-positive-values-in-julia](https://stackoverflow.com/questions/68675457/how-to-delete-the-columns-of-a-dataframe-that-have-only-positive-values-in-julia)
