MCPcopy
hub / github.com/pandas-dev/pandas / read

Method read

pandas/io/pytables.py:4789–4889  ·  view source on GitHub ↗
(
        self,
        where=None,
        columns=None,
        start: int | None = None,
        stop: int | None = None,
    )

Source from the content-addressed store, hash-verified

4787 return obj
4788
4789 def read(
4790 self,
4791 where=None,
4792 columns=None,
4793 start: int | None = None,
4794 stop: int | None = None,
4795 ):
4796 # validate the version
4797 self.validate_version(where)
4798
4799 # infer the data kind
4800 if not self.infer_axes():
4801 return None
4802
4803 result = self._read_axes(where=where, start=start, stop=stop)
4804
4805 info = (
4806 self.info.get(self.non_index_axes[0][0], {})
4807 if len(self.non_index_axes)
4808 else {}
4809 )
4810
4811 inds = [i for i, ax in enumerate(self.axes) if ax is self.index_axes[0]]
4812 assert len(inds) == 1
4813 ind = inds[0]
4814
4815 index = result[ind][0]
4816
4817 frames = []
4818 for i, a in enumerate(self.axes):
4819 if a not in self.values_axes:
4820 continue
4821 index_vals, cvalues = result[i]
4822
4823 # we could have a multi-index constructor here
4824 # ensure_index doesn't recognized our list-of-tuples here
4825 if info.get("type") != "MultiIndex":
4826 cols = Index(index_vals)
4827 else:
4828 cols = MultiIndex.from_tuples(index_vals)
4829
4830 names = info.get("names")
4831 if names is not None:
4832 cols.set_names(names, inplace=True)
4833
4834 if self.is_transposed:
4835 values = cvalues
4836 index_ = cols
4837 cols_ = Index(index, name=getattr(index, "name", None))
4838 else:
4839 values = cvalues.T
4840 index_ = Index(index, name=getattr(index, "name", None))
4841 cols_ = cols
4842
4843 # if we have a DataIndexableCol, its shape will only be 1 dim
4844 if values.ndim == 1 and isinstance(values, np.ndarray):
4845 values = values.reshape((1, values.shape[0]))
4846

Callers

nothing calls this directly

Calls 15

set_namesMethod · 0.95
IndexClass · 0.90
DataFrameClass · 0.90
using_string_dtypeFunction · 0.90
StringDtypeClass · 0.90
concatFunction · 0.90
SelectionClass · 0.85
infer_axesMethod · 0.80
_read_axesMethod · 0.80
endswithMethod · 0.80
_from_arraysMethod · 0.80
process_axesMethod · 0.80

Tested by

no test coverage detected