Skip to content

Commit

Permalink
How do I add a new variable to dataset. (#3679)
Browse files Browse the repository at this point in the history
* How do I add a new variable to dataset.

* Update doc/howdoi.rst

Improvement from dcherian

Co-Authored-By: Deepak Cherian <[email protected]>

* Add cross-reference per suggestion.

* Fix cross-reference.

* Update doc/howdoi.rst

Suggestion from keewis

Co-Authored-By: keewis <[email protected]>

Co-authored-by: Deepak Cherian <[email protected]>
Co-authored-by: keewis <[email protected]>
  • Loading branch information
3 people committed Jan 10, 2020
1 parent e8dbe6e commit ff75081
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/data-structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ setting) variables and attributes:
This is particularly useful in an exploratory context, because you can
tab-complete these variable names with tools like IPython.

.. _dictionary_like_methods:

Dictionary like methods
~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
3 changes: 3 additions & 0 deletions doc/howdoi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ How do I ...

* - How do I...
- Solution
* - add a DataArray to my dataset as a new variable
- ``my_dataset[varname] = my_dataArray`` or :py:meth:`Dataset.assign` (see also :ref:`dictionary_like_methods`)
* - add variables from other datasets to my dataset
- :py:meth:`Dataset.merge`
* - add a new dimension and/or coordinate
Expand Down Expand Up @@ -57,3 +59,4 @@ How do I ...
- ``obj.dt.ceil``, ``obj.dt.floor``, ``obj.dt.round``. See :ref:`dt_accessor` for more.
* - make a mask that is ``True`` where an object contains any of the values in a array
- :py:meth:`Dataset.isin`, :py:meth:`DataArray.isin`

0 comments on commit ff75081

Please sign in to comment.