Selecting from DataFrames
You can "search/select" data by generating "boolean" arrays based on some criteria. This works by effectively generating a column of True/False values that Pandas uses to select particular rows (those that are true). There are a few ways to generate this true/false selection column.
Value-based selections
You provide a selection criteria for a particular column. Example:
# generates the true/false array
my_dataframe['my_column']>=some_valueIs-in based selections
You provide a list of values you want to search for. Example:
subset_of_rows = my_dataframe['column_name'].isin([list_of_values])Other
There are lots of ways to do this - you can learn more here
Boolean Indexing
ms['Precursor Charge']==3This is boolean indexing - you can make very complicated selection criteria to just pull out the data you want
selection_criteria = ms['Precursor Charge']==3 #now we have saved the selection criteriaselection_criteria







Last updated
Was this helpful?
