@@ -255,14 +255,14 @@ def _get_str_rows(self, rows):
255255 row_str : list
256256 List of boolean values indicating which rows contain strings
257257 """
258- str_bool = self .str_bool
258+ _row_idx_str_bool = self ._row_idx_str_bool
259259 if isinstance (rows , slice ):
260260 slice_idx = rows .indices (self .shape [0 ])
261261 row_list = np .arange (slice_idx [0 ], slice_idx [1 ], slice_idx [2 ])
262- row_str = [str_bool [row ] for row in row_list ]
262+ row_str = [_row_idx_str_bool [row ] for row in row_list ]
263263 else :
264264 row_list = list (rows )
265- row_str = [str_bool [row ] for row in rows ]
265+ row_str = [_row_idx_str_bool [row ] for row in rows ]
266266 return row_list , row_str
267267
268268 def __getitem__ (self , key_idx ):
@@ -633,19 +633,42 @@ def rows(self):
633633
634634
635635 @property
636- def str_bool (self ):
636+ def _row_idx_str_bool (self ):
637637 """Dictionary of index : if data entry is string.
638638
639639 Row has string values if the string map is nonempty for a
640640 given row.
641641
642642 Returns
643643 -------
644- str_bool : Dict
644+ _row_idx_str_bool : Dict
645645 Dictionary of whether data at row number key is string or not
646646 """
647- str_bool = {self .map [k ]: bool (len (self .str_map [k ])) for k in self .str_map .keys ()}
648- return str_bool
647+ _row_idx_str_bool = {self .map [k ]: bool (len (self .str_map [k ])) for k in self .str_map .keys ()}
648+ return _row_idx_str_bool
649+
650+ def is_str (self , row_name ):
651+ """Check whether a row contained string values.
652+
653+ Parameters
654+ ----------
655+ row_name : string
656+ Name of the row to check whether it contains string values.
657+
658+ Returns
659+ -------
660+ contains_str : bool
661+ True if the row contains string values, False otherwise.
662+
663+ """
664+
665+ if row_name not in self .map :
666+ raise KeyError ("'" + str (row_name ) \
667+ + "' key doesn't exist in NavData class" )
668+
669+ contains_str = self ._row_idx_str_bool [self .map [row_name ]]
670+
671+ return contains_str
649672
650673 @property
651674 def inv_map (self ):
0 commit comments