fetch_metrics()
Python package: neptune-query
Fetches a table of metric values per step.
The values are raw, without any aggregation, approximation, or interpolation.
To limit the results, set the step range or the number of values to include from the tail end.
You can also filter the results by:
- Runs: Specify which runs to search.
- Attributes: Only list attributes that match certain criteria.
Parameters
Returns
pandas.DataFrame
– A table of metric values per step. The DataFrame has a MultiIndex with:
- Index:
["run", "step"]
- Columns: attribute names with the following sub-columns:
"value"
– metric values"absolute_time"
if theinclude_time
argument is set to"absolute"
"is_preview"
if theinclude_point_previews
argument is set toTrue
"preview_completion"
if theinclude_point_previews
argument is set toTrue
Raises
AttributeTypeInferenceError
– If the attribute type wasn't specified in a filter passed to theruns
argument, and the attribute has multiple types across the project's runs.ConflictingAttributeTypes
– If there are conflicting attribute types under the same path and thetype_suffix_in_column_names
argument is set toFalse
.
Examples
Fetch the last 12 values of a specific run's losses and accuracies, including incomplete points:
import neptune_query.runs as nq_runs
nq_runs.fetch_metrics(
runs=["prompt-wolf-2g2r1"], # custom run ID
attributes=r"loss | acc",
tail_limit=12,
include_point_previews=True,
)
Sample output
accuracy loss
is_preview preview_completion value is_preview preview_completion value
run step
prompt-wolf-2g2r1 37.0 False 1.000000 0.822683 False 1.000000 0.192384
38.0 False 1.000000 0.821014 False 1.000000 0.200655
39.0 False 1.000000 0.800180 False 1.000000 0.181736
41.0 True 0.756098 0.813834 True 0.756098 0.178080
42.0 True 0.761905 0.802206 True 0.761905 0.178129
43.0 True 0.767442 0.822235 True 0.767442 0.192478
44.0 True 0.772727 0.809570 True 0.772727 0.192476
45.0 True 0.777778 0.817433 True 0.777778 0.191994
46.0 True 0.782609 0.802809 True 0.782609 0.186171
47.0 True 0.787234 0.803025 True 0.787234 0.196133
48.0 True 0.791667 0.820802 True 0.791667 0.188257
49.0 True 0.795918 0.821936 True 0.795918 0.182162
Fetch the last 10 values of a specific run's losses, including all extra information:
import neptune_query.runs as nq_runs
nq_runs.fetch_metrics(
runs=["prompt-wolf-2g2r1"], # custom run ID
attributes=r"loss",
tail_limit=10,
include_time="absolute",
type_suffix_in_column_names=True,
include_point_previews=True,
)
Sample output
loss:float_series
absolute_time is_preview preview_completion value
run step
prompt-wolf-2g2r1 34.0 2025-08-29 09:18:27.875000+00:00 False 1.000000 0.184275
35.0 2025-08-29 09:18:27.884000+00:00 False 1.000000 0.191002
36.0 2025-08-29 09:18:27.888000+00:00 False 1.000000 0.197030
37.0 2025-08-29 09:18:27.891000+00:00 False 1.000000 0.192384
38.0 2025-08-29 09:18:27.895000+00:00 False 1.000000 0.200655
39.0 2025-08-29 09:18:27.899000+00:00 False 1.000000 0.181736
41.0 2025-08-29 09:18:27.902000+00:00 True 0.756098 0.178080
42.0 2025-08-29 09:18:27.902000+00:00 True 0.761905 0.178129
43.0 2025-08-29 09:18:27.916000+00:00 True 0.767442 0.192478
44.0 2025-08-29 09:18:27.920000+00:00 True 0.772727 0.192476