MCPcopy
hub / github.com/feast-dev/feast / to_dict

Method to_dict

sdk/python/feast/online_response.py:64–88  ·  view source on GitHub ↗

Converts GetOnlineFeaturesResponse features into a dictionary form. Args: include_event_timestamps: bool Optionally include feature timestamps in the dictionary

(self, include_event_timestamps: bool = False)

Source from the content-addressed store, hash-verified

62 break
63
64 def to_dict(self, include_event_timestamps: bool = False) -> Dict[str, Any]:
65 """
66 Converts GetOnlineFeaturesResponse features into a dictionary form.
67
68 Args:
69 include_event_timestamps: bool Optionally include feature timestamps in the dictionary
70 """
71 response: Dict[str, List[Any]] = {}
72
73 for feature_ref, feature_vector in zip(
74 self.proto.metadata.feature_names.val, self.proto.results
75 ):
76 feature_type = self._feature_types.get(feature_ref)
77 response[feature_ref] = [
78 feast_value_type_to_python_type(v, feature_type)
79 for v in feature_vector.values
80 ]
81
82 if include_event_timestamps:
83 timestamp_ref = feature_ref + TIMESTAMP_POSTFIX
84 response[timestamp_ref] = [
85 ts.seconds for ts in feature_vector.event_timestamps
86 ]
87
88 return response
89
90 def to_df(self, include_event_timestamps: bool = False) -> pd.DataFrame:
91 """

Callers 4

to_dfMethod · 0.95
to_arrowMethod · 0.95
to_tensorMethod · 0.95

Calls 2

getMethod · 0.80

Tested by

no test coverage detected