Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
204 views
in Technique[技术] by (71.8m points)

r - How do I delete a column in a dataframe that has no title but contains a list of numbers from 1-39?

I have a data frame that has a list of species and sites that I'd like to compute for some analysis using beta.pair: Incidence-based pair-wise dissimilarities. In betapart: Partitioning Beta Diversity into Turnover and Nestedness Components. However, there is a first column (without heading) but contains numbers from 1-39 that I would like to remove so that the function can read the presence-absence data.

The data frame looks something like this:

enter image description here

question from:https://stackoverflow.com/questions/65909491/how-do-i-delete-a-column-in-a-dataframe-that-has-no-title-but-contains-a-list-of

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It looks like an index column. It should not affect the analyses you are trying to do. There are several uses for the index column. For instance, you can use the index for explicitly analyzing or subsetting your data.

You can check to see if that is an index column or not by looking at the shape of the data.

If this is pandas dataframe, you could try

df.shape

and it should show the actual dimensions of the data (without the index included). So for the example table you provided, the result would be - (21, 7).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...