Get a column from the table. If a column called name exists in the table, it is read and returned as a NumPy object. If it does not exist, a KeyError is raised. Examples -------- :: narray = table.col('var2') That statement is equivalen
(self, name: str)
| 2157 | ) |
| 2158 | |
| 2159 | def col(self, name: str) -> np.ndarray: |
| 2160 | """Get a column from the table. |
| 2161 | |
| 2162 | If a column called name exists in the table, it is read and returned as |
| 2163 | a NumPy object. If it does not exist, a KeyError is raised. |
| 2164 | |
| 2165 | Examples |
| 2166 | -------- |
| 2167 | :: |
| 2168 | |
| 2169 | narray = table.col('var2') |
| 2170 | |
| 2171 | That statement is equivalent to:: |
| 2172 | |
| 2173 | narray = table.read(field='var2') |
| 2174 | |
| 2175 | Here you can see how this method can be used as a shorthand for the |
| 2176 | :meth:`Table.read` method. |
| 2177 | |
| 2178 | """ |
| 2179 | return self.read(field=name) |
| 2180 | |
| 2181 | def __getitem__( |
| 2182 | self, key: int | slice | list[int] | list[bool] | np.ndarray |