# xarray.Dataset

class `xarray.``Dataset`(data_vars: Mapping[Hashable, Any] = None, coords: Mapping[Hashable, Any] = None, attrs: Mapping[Hashable, Any] = None)

  A multi-dimensional, in memory, array database.

  A dataset resembles an in-memory representation of a NetCDF file, and consists of variables, coordinates and attributes which together form a self describing dataset.

  Dataset implements the mapping interface with keys given by variable names and values given by DataArray objects for each variable name.

  One dimensional variables with name equal to their dimension are index coordinates used for label based indexing.

  `__init__`(data_vars: Mapping[Hashable, Any] = None, coords: Mapping[Hashable, Any] = None, attrs: Mapping[Hashable, Any] = None)

    To load data from a file or file-like object, use the open_dataset function.

    Parameters:

    - data_vars (dict-like, optional) –

      A mapping from variable names to `DataArray` objects, `Variable` objects or to tuples of the form `(dims, data[, attrs])` which can be used as arguments to create a new `Variable`. Each dimension must have the same length in all variables in which it appears.

      The following notations are accepted:

      - mapping {var name: DataArray}
      - mapping {var name: Variable}
      - mapping {var name: (dimension name, array-like)}
      - mapping {var name: (tuple of dimension names, array-like)}
      - mapping {dimension name: array-like} (it will be automatically moved to coords, see below)

      Each dimension must have the same length in all variables in which it appears.

    - coords (dict-like, optional) –

      Another mapping in similar form as the data_vars argument, except the each item is saved on the dataset as a “coordinate”. These variables have an associated meaning: they describe constant/fixed/independent quantities, unlike the varying/measured/dependent quantities that belong in variables. Coordinates values may be given by 1-dimensional arrays or scalars, in which case dims do not need to be supplied: 1D arrays will be assumed to give index values along the dimension with the same name.

      The following notations are accepted:

      - mapping {coord name: DataArray}
      - mapping {coord name: Variable}
      - mapping {coord name: (dimension name, array-like)}
      - mapping {coord name: (tuple of dimension names, array-like)}
      - mapping {dimension name: array-like} (the dimension name is implicitly set to be the same as the coord name)

      The last notation implies that the coord name is the same as the dimension name.

    - attrs (dict-like, optional) – Global attributes to save on this dataset.

  Methods

  `__init__`(data_vars, Any] = None, coords, …) | To load data from a file or file-like object, use the open_dataset function.
  `all`([dim]) | Reduce this Dataset’s data by applying all along some dimension(s).
  `any`([dim]) | Reduce this Dataset’s data by applying any along some dimension(s).
  `apply`(func, keep_attrs, args, **kwargs) | Backward compatible implementation of `map`
  `argmax`([dim, skipna]) | Reduce this Dataset’s data by applying argmax along some dimension(s).
  `argmin`([dim, skipna]) | Reduce this Dataset’s data by applying argmin along some dimension(s).
  `argsort`([axis, kind, order]) | Returns the indices that would sort this array.
  `assign`(variables, Any] = None, …) | Assign new data variables to a Dataset, returning a new object with all the original variables in addition to the new ones.
  `assign_attrs`(*args, **kwargs) | Assign new attrs to this object.
  `assign_coords`([coords]) | Assign new coordinates to this object.
  `astype`(dtype[, order, casting, subok, copy]) | Copy of the array, cast to a specified type.
  `bfill`(dim, limit) | Fill NaN values by propogating values backward
  `broadcast_equals`(other) | Two Datasets are broadcast equal if they are equal after broadcasting all variables against each other.
  `broadcast_like`(other, DataArray], exclude) | Broadcast this DataArray against another Dataset or DataArray.
  `chunk`(chunks, numbers.Number, …) | Coerce all arrays in this dataset into dask arrays with the given chunks.
  `clip`([min, max, out]) | Return an array whose values are limited to `[min, max]`.
  `close`() | Close any files linked to this object
  `coarsen`(dim, int] = None, boundary, side, …) | Coarsen object.
  `combine_first`(other) | Combine two Datasets, default to data_vars of self.
  `compute`(**kwargs) | Manually trigger loading and/or computation of this dataset’s data from disk or a remote source into memory and return a new dataset.
  `conj`() | Complex-conjugate all elements.
  `conjugate`() | Return the complex conjugate, element-wise.
  `copy`(deep, data, VT_co] = None) | Returns a copy of this dataset.
  `count`([dim]) | Reduce this Dataset’s data by applying count along some dimension(s).
  `cumprod`([dim, skipna]) | Apply cumprod along some dimension of Dataset.
  `cumsum`([dim, skipna]) | Apply cumsum along some dimension of Dataset.
  `diff`(dim[, n, label]) | Calculate the n-th order discrete difference along given axis.
  `differentiate`(coord[, edge_order, datetime_unit]) | Differentiate with the second order accurate central differences.
  `drop`([labels, dim, errors]) | Backward compatible method based on drop_vars and drop_sel
  `drop_dims`(drop_dims, Iterable[Hashable]], *, …) | Drop dimensions and associated variables from this dataset.
  `drop_sel`([labels, errors]) | Drop index labels from this dataset.
  `drop_vars`(names, Iterable[Hashable]], *, errors) | Drop variables from this dataset.
  `dropna`(dim, how, thresh, subset) | Returns a new dataset with dropped labels for missing values along the provided dimension.
  `dump_to_store`(store, **kwargs) | Store dataset contents to a backends.*DataStore object.
  `equals`(other) | Two Datasets are equal if they have matching variables and coordinates, all of which are equal.
  `expand_dims`(dim, Hashable, …) | Return a new object with an additional axis (or axes) inserted at the corresponding position in the array shape.
  `ffill`(dim, limit) | Fill NaN values by propogating values forward
  `fillna`(value) | Fill missing values in this object.
  `filter_by_attrs`(**kwargs) | Returns a `Dataset` with variables that match specific conditions.
  `from_dataframe`(dataframe, sparse) | Convert a pandas.DataFrame into an xarray.Dataset
  `from_dict`(d) | Convert a dictionary into an xarray.Dataset.
  `get`(k[,d]) |
  `get_index`(key) | Get an index for a dimension, with fall-back to a default RangeIndex
  `groupby`(group, squeeze, restore_coord_dims) | Returns a GroupBy object for performing grouped operations.
  `groupby_bins`(group, bins, right[, labels]) | Returns a GroupBy object for performing grouped operations.
  `head`(indexers, int], int] = None, …) | Returns a new dataset with the first n values of each array for the specified dimension(s).
  `identical`(other) | Like equals, but also checks all dataset attributes and the attributes on all variables and coordinates.
  `info`([buf]) | Concise summary of a Dataset variables and attributes.
  `integrate`(coord[, datetime_unit]) | integrate the array with the trapezoidal rule.
  `interp`(coords, Any] = None, method, …) | Multidimensional interpolation of Dataset.
  `interp_like`(other, DataArray], method, …) | Interpolate this object onto the coordinates of another object, filling the out of range values with NaN.
  `interpolate_na`(dim, method, limit, …) | Fill in NaNs by interpolating according to different methods.
  `isel`(indexers, Any] = None, drop, …) | Returns a new dataset with each array indexed along the specified dimension(s).
  `isin`(test_elements) | Tests each value in the array for whether it is in test elements.
  `isnull`(*args, **kwargs) |
  `items`() |
  `keys`() |
  `load`(**kwargs) | Manually trigger loading and/or computation of this dataset’s data from disk or a remote source into memory and return this dataset.
  `load_store`(store[, decoder]) | Create a new dataset from the contents of a backends.*DataStore object
  `map`(func, keep_attrs, args, **kwargs) | Apply a function to each variable in this dataset
  `map_blocks`(func, T_DSorDA], args, kwargs, …) | Apply a function to each chunk of this Dataset.
  `max`([dim, skipna]) | Reduce this Dataset’s data by applying max along some dimension(s).
  `mean`([dim, skipna]) | Reduce this Dataset’s data by applying mean along some dimension(s).
  `median`([dim, skipna]) | Reduce this Dataset’s data by applying median along some dimension(s).
  `merge`(other, DataArray], inplace, …) | Merge the arrays of two datasets into a single dataset.
  `min`([dim, skipna]) | Reduce this Dataset’s data by applying min along some dimension(s).
  `notnull`(*args, **kwargs) |
  `persist`(**kwargs) | Trigger computation, keeping data as dask arrays
  `pipe`(func, T], Tuple[Callable[[…], T], …) | Apply `func(self, *args, **kwargs)`
  `prod`([dim, skipna]) | Reduce this Dataset’s data by applying prod along some dimension(s).
  `quantile`(q[, dim, interpolation, …]) | Compute the qth quantile of the data along the specified dimension.
  `rank`(dim[, pct, keep_attrs]) | Ranks the data.
  `reduce`(func, dim, …) | Reduce this dataset by applying func along some dimension(s).
  `reindex`(indexers, Any] = None, method, …) | Conform this object onto a new set of indexes, filling in missing values with `fill_value`.
  `reindex_like`(other, DataArray], method, …) | Conform this object onto the indexes of another object, filling in missing values with `fill_value`.
  `rename`(name_dict, Hashable] = None, inplace, …) | Returns a new object with renamed variables and dimensions.
  `rename_dims`(dims_dict, Hashable] = None, **dims) | Returns a new object with renamed dimensions only.
  `rename_vars`(name_dict, Hashable] = None, **names) | Returns a new object with renamed variables including coordinates
  `reorder_levels`(dim_order, …) | Rearrange index levels using input order.
  `resample`(indexer, str] = None[, skipna, loffset]) | Returns a Resample object for performing resampling operations.
  `reset_coords`(names, Iterable[Hashable], …) | Given names of coordinates, reset them to become variables
  `reset_index`(dims_or_levels, …) | Reset the specified index(es) or multi-index level(s).
  `roll`([shifts, roll_coords]) | Roll this dataset by an offset along one or more dimensions.
  `rolling`(dim, int] = None, min_periods, …) | Rolling window object.
  `rolling_exp`(window, int] = None, …) | Exponentially-weighted moving window.
  `round`(*args, **kwargs) |
  `sel`(indexers, Any] = None, method, …) | Returns a new dataset with each array indexed by tick labels along the specified dimension(s).
  `set_coords`(names, Iterable[Hashable]], inplace) | Given names of one or more variables, set them as coordinates
  `set_index`(indexes, Union[Hashable, …) | Set Dataset (multi-)indexes using one or more existing coordinates or variables.
  `shift`([shifts, fill_value]) | Shift this dataset by an offset along one or more dimensions.
  `sortby`(variables[, ascending]) | Sort object by labels or values (along an axis).
  `squeeze`(dim, Iterable[Hashable], …) | Return a new object with squeezed data.
  `stack`(dimensions, …) | Stack any number of existing dimensions into a single new dimension.
  `std`([dim, skipna]) | Reduce this Dataset’s data by applying std along some dimension(s).
  `sum`([dim, skipna]) | Reduce this Dataset’s data by applying sum along some dimension(s).
  `swap_dims`(dims_dict, Hashable], inplace) | Returns a new object with swapped dimensions.
  `tail`(indexers, int], int] = None, …) | Returns a new dataset with the last n values of each array for the specified dimension(s).
  `thin`(indexers, int], int] = None, …) | Returns a new dataset with each array indexed along every n-th value for the specified dimension(s)
  `to_array`([dim, name]) | Convert this dataset into an xarray.DataArray
  `to_dask_dataframe`([dim_order, set_index]) | Convert this dataset into a dask.dataframe.DataFrame.
  `to_dataframe`() | Convert this dataset into a pandas.DataFrame.
  `to_dict`([data]) | Convert this dataset to a dictionary following xarray naming conventions.
  `to_netcdf`([path]) | Write dataset contents to a netCDF file.
  `to_stacked_array`(new_dim, sample_dims, …) | Combine variables of differing dimensionality into a DataArray without broadcasting.
  `to_zarr`(store, VT], str, …[, synchronizer]) | Write dataset contents to a zarr group.
  `transpose`(*dims) | Return a new Dataset object with all array dimensions transposed.
  `unify_chunks`() | Unify chunk size along all chunked dimensions of this Dataset.
  `unstack`(dim, Iterable[Hashable]] = None, …) | Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions.
  `update`(other, inplace) | Update this dataset’s variables with those from another dataset.
  `values`() |
  `var`([dim, skipna]) | Reduce this Dataset’s data by applying var along some dimension(s).
  `where`(cond[, other]) | Filter elements from this object according to a condition.

  Attributes

  `attrs` | Dictionary of global attributes on this dataset
  `chunks` | Block dimensions for this dataset’s data or None if it’s not a dask array.
  `coords` | Dictionary of xarray.DataArray objects corresponding to coordinate variables
  `data_vars` | Dictionary of DataArray objects corresponding to data variables
  `dims` | Mapping from dimension names to lengths.
  `encoding` | Dictionary of global encoding attributes on this dataset
  `imag` |
  `indexes` | Mapping of pandas.Index objects used for label based indexing
  `loc` | Attribute for location based indexing.
  `nbytes` |
  `plot` | Access plotting functions for Datasets.
  `real` |
  `sizes` | Mapping from dimension names to lengths.
  `variables` | Low level interface to Dataset contents as dict of Variable objects.