nuctransportdb.data_tagging

Functions

string_in_strings(→ bool)

Check if 'target' exists in 'strings'.

get_tagged_data_mask(property_df, tag_type, tag_names)

Get masks for multiple tag names in a specific tag type.

filter_tagged_data(property_df, tag_dict)

Filter the DataFrame based on multiple tag criteria.

Module Contents

nuctransportdb.data_tagging.string_in_strings(target, strings) bool[source]

Check if ‘target’ exists in ‘strings’.

Parameters:
  • target (str) – string to search for.

  • strings (list, str, None) – list or string containing multiple entries

Returns:

True if target is found in the strings, False otherwise.

Return type:

bool

nuctransportdb.data_tagging.get_tagged_data_mask(property_df, tag_type, tag_names)[source]

Get masks for multiple tag names in a specific tag type.

Parameters:
  • property_df (pd.DataFrame) – Input DataFrame.

  • tag_type (str) – Specific tag type. It can be “agency”, “location”, or “simplified_lithology”.

  • tag_names (list) – List of tag names.

Returns:

A Boolean series indicating which data entries have the specified tags.

Return type:

pd.Series

nuctransportdb.data_tagging.filter_tagged_data(property_df, tag_dict)[source]

Filter the DataFrame based on multiple tag criteria.

Parameters:
  • property_df (pd.DataFrame) – Input DataFrame.

  • tag_dict (dict) – Dictionary where keys are tag types (“agency”, “location”, “simplified_lithology”) and values are lists of tag names.

Returns:

Filtered DataFrame containing only rows that match all specified tag criteria.

Return type:

pd.DataFrame