File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -269,24 +269,24 @@ def str_to_float(value: str, default: float = np.nan) -> float:
269269 return default
270270
271271
272- def cut_str (value : str , max_length : int ) -> np .chararray :
273- """Cut a string to a specific length and return it as a numpy chararray .
272+ def cut_str (value : str , max_length : int ) -> np .ndarray :
273+ """Cut a string to a specific length and return it as a NumPy array with fixed-length strings .
274274
275275 Parameters
276276 ----------
277277 value : str
278- String to cut
278+ String to cut.
279279 max_length : int
280- Length of the output
280+ Maximum length of the output string.
281281
282282 Returns
283283 -------
284- out : np.chararray
285- String with max_length characters
284+ out : np.ndarray
285+ NumPy array containing the truncated string with fixed-length dtype.
286286 """
287- charar = np . chararray ( 1 , max_length )
288- charar [: max_length ] = value
289- return charar
287+ truncated_value = value [: max_length ]
288+ char_array = np . array ([ truncated_value ], dtype = f"<U { max_length } " )
289+ return char_array
290290
291291
292292def drogue_presence (lost_time , time ) -> np .ndarray :
You can’t perform that action at this time.
0 commit comments