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

Method _write_to_group

pandas/io/pytables.py:1914–1974  ·  view source on GitHub ↗
(
        self,
        key: str,
        value: DataFrame | Series,
        format,
        axes=None,
        index: bool | list[str] = True,
        append: bool = False,
        complib=None,
        complevel: int | None = None,
        fletcher32=None,
        min_itemsize: int | dict[str, int] | None = None,
        chunksize: int | None = None,
        expectedrows=None,
        dropna: bool = False,
        nan_rep=None,
        data_columns=None,
        encoding=None,
        errors: str = "strict",
        track_times: bool = True,
    )

Source from the content-addressed store, hash-verified

1912 return cls(self, group, encoding=encoding, errors=errors)
1913
1914 def _write_to_group(
1915 self,
1916 key: str,
1917 value: DataFrame | Series,
1918 format,
1919 axes=None,
1920 index: bool | list[str] = True,
1921 append: bool = False,
1922 complib=None,
1923 complevel: int | None = None,
1924 fletcher32=None,
1925 min_itemsize: int | dict[str, int] | None = None,
1926 chunksize: int | None = None,
1927 expectedrows=None,
1928 dropna: bool = False,
1929 nan_rep=None,
1930 data_columns=None,
1931 encoding=None,
1932 errors: str = "strict",
1933 track_times: bool = True,
1934 ) -> None:
1935 # we don't want to store a table node at all if our object is 0-len
1936 # as there are not dtypes
1937 if getattr(value, "empty", None) and (format == "table" or append):
1938 return
1939
1940 group = self._identify_group(key, append)
1941
1942 s = self._create_storer(group, format, value, encoding=encoding, errors=errors)
1943 if append:
1944 # raise if we are trying to append to a Fixed format,
1945 # or a table that exists (and we are putting)
1946 if not s.is_table or (s.is_table and format == "fixed" and s.is_exists):
1947 raise ValueError("Can only append to Tables")
1948 if not s.is_exists:
1949 s.set_object_info()
1950 else:
1951 s.set_object_info()
1952
1953 if not s.is_table and complib:
1954 raise ValueError("Compression not supported on Fixed format stores")
1955
1956 # write the object
1957 s.write(
1958 obj=value,
1959 axes=axes,
1960 append=append,
1961 complib=complib,
1962 complevel=complevel,
1963 fletcher32=fletcher32,
1964 min_itemsize=min_itemsize,
1965 chunksize=chunksize,
1966 expectedrows=expectedrows,
1967 dropna=dropna,
1968 nan_rep=nan_rep,
1969 data_columns=data_columns,
1970 track_times=track_times,
1971 )

Callers 2

putMethod · 0.95
appendMethod · 0.95

Calls 5

_identify_groupMethod · 0.95
_create_storerMethod · 0.95
set_object_infoMethod · 0.80
writeMethod · 0.45
create_indexMethod · 0.45

Tested by

no test coverage detected