Issue
Suppose there is a data frame that has 120 columns. I need only column with numbers 2-50, 59-84, and 95-110. I tried this code. And it doesnt work.
df.iloc[:,[2:50,59:84,95:110]]
Solution
df.iloc[:, lambda df: [*range(2, 50)] + [*range(59, 84)] + [*range(95, 110)]
Answered By - the_pr0blem
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.