hosseinmoein / DataFrame

C++ DataFrame for statistical, Financial, and ML analysis -- in modern C++ using native types and contiguous memory storage
https://hosseinmoein.github.io/DataFrame/
BSD 3-Clause "New" or "Revised" License
2.54k stars 313 forks source link

Can provide a function to query the column index from the column name #177

Closed czyt1988 closed 2 years ago

czyt1988 commented 2 years ago

Can provide a function to query the column index from the column name? Because I found that some functions will change the original index of the column, such as rename_column,retype_column,consolidate,self_shift etc. On some occasions, I get the column through the column index, but I find that after calling the rename_column function, the index of the original column becomes the last, so I hope there is a method to get the column index corresponding to the column name.

hosseinmoein commented 2 years ago

I don't have those methods yet. accessing by name was always the primary method of accessing columns, so I didn't put a lot of emphases on accessing by index. But, I can add those methods sometimes over the weekend

hosseinmoein commented 2 years ago

@czyt1988 ,

This has been implemented in master https://htmlpreview.github.io/?https://github.com/hosseinmoein/DataFrame/blob/master/docs/HTML/col_name_to_idx.html

czyt1988 commented 2 years ago

Thank you very much