MCPcopy Create free account
hub / github.com/PyTables/PyTables / _f_col

Method _f_col

tables/table.py:3318–3346  ·  view source on GitHub ↗

Get an accessor to the column colname. This method returns a Column instance (see :ref:`ColumnClassDescr`) if the requested column is not nested, and a Cols instance (see :ref:`ColsClassDescr`) if it is. You may use full column pathnames in colname. Calling

(self, colname: str)

Source from the content-addressed store, hash-verified

3316 return len(self._v_colnames)
3317
3318 def _f_col(self, colname: str) -> Cols:
3319 """Get an accessor to the column colname.
3320
3321 This method returns a Column instance (see :ref:`ColumnClassDescr`) if
3322 the requested column is not nested, and a Cols instance (see
3323 :ref:`ColsClassDescr`) if it is. You may use full column pathnames in
3324 colname.
3325
3326 Calling cols._f_col('col1/col2') is equivalent to using cols.col1.col2.
3327 However, the first syntax is more intended for programmatic use. It is
3328 also better if you want to access columns with names that are not valid
3329 Python identifiers.
3330
3331 """
3332 if not isinstance(colname, str):
3333 raise TypeError(
3334 f"Parameter can only be an string. You passed object: "
3335 f"{colname}"
3336 )
3337 if (
3338 colname.find("/") > -1 and colname not in self._v_colpathnames
3339 ) and colname not in self._v_colnames:
3340 raise KeyError(
3341 f"Cols accessor "
3342 f"``{self._v__tablePath}.cols{self._v_desc._v_pathname}`` "
3343 f"does not have a column named ``{colname}``"
3344 )
3345
3346 return self._g_col(colname)
3347
3348 def _g_col(self, colname: str) -> Cols:
3349 """Like `self._f_col()` but it does not check arguments."""

Callers 15

colindexesMethod · 0.80
_check_sortby_csiMethod · 0.80
dump_leafFunction · 0.80
recreate_indexesFunction · 0.80
test00_descriptionMethod · 0.80
_checkColumnsMethod · 0.80
_checkColinstancesMethod · 0.80
_testCondVarsMethod · 0.80
_testNestedCondVarsMethod · 0.80
test05b_modifyColumnsMethod · 0.80
test07_indexMethod · 0.80
test01a_f_colMethod · 0.80

Calls 1

_g_colMethod · 0.95

Tested by 15

test00_descriptionMethod · 0.64
_checkColumnsMethod · 0.64
_checkColinstancesMethod · 0.64
_testCondVarsMethod · 0.64
_testNestedCondVarsMethod · 0.64
test05b_modifyColumnsMethod · 0.64
test07_indexMethod · 0.64
test01a_f_colMethod · 0.64
test01b_f_colMethod · 0.64
test01c_f_colMethod · 0.64
test04a__getitem__Method · 0.64
test04b__getitem__Method · 0.64