0%

How to handle with null values: exclude empty fields

For different fields, you may encounter null values. When working in Python (NumPy or Pandas), they are represented as NaN in tables. A null value means that there is no data in this field for a given document, or that the field is not defined or not used for that document.

You can filter out null values by applying this range filter that we have seen before: field:[* TO *]. It works for both string and numeric values.

num_found, df = solr_request(
    core='statistical-result', 
    params={
        'q': 'effect_size:[* TO *]',
        'fl': 'marker_symbol,top_level_mp_term_name,effect_size,p_value',
        'rows': 3
    }
)

In this example, hits without an effect_size were filtered out.