Quick DataFrame question: I am trying to read CSVs that, for some reason, have pos

quick DataFrame question: I am trying to read CSVs that, for some reason, have possibly many columns of missing data at the end. The columns are entirely missing.

Is there something similar to dropmissing that operates on columns?

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

There are a few options here.

select(df, Not(names(df, Missing))
df[:, eltype.(eachcol(df)) .!= Missing]

If you want to use this solution in the context of piping one solution is

@chain df begin 
    select(_, Not(names(_, Missing))
end
1 Like