Skip to content

Commit ff75081

Browse files
rpgoldmandcheriankeewis
committed
How do I add a new variable to dataset. (#3679)
* 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]>
1 parent e8dbe6e commit ff75081

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

doc/data-structures.rst

+2
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ setting) variables and attributes:
353353
This is particularly useful in an exploratory context, because you can
354354
tab-complete these variable names with tools like IPython.
355355

356+
.. _dictionary_like_methods:
357+
356358
Dictionary like methods
357359
~~~~~~~~~~~~~~~~~~~~~~~
358360

doc/howdoi.rst

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ How do I ...
1111

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

0 commit comments

Comments
 (0)