Commit cb473ed5 authored by Benjamin Laken's avatar Benjamin Laken
Browse files

Update 01-numpy.md

Students in the last session in Oslo were asking how to see what had been declared/loaded already. It is a good command that I often use when working, I think it is easy, and also very nice to know from the start. Showing them the command so early on could help them conceptualise the namespace more effectively.
parent 36c170c5
......@@ -156,6 +156,19 @@ Since `weight_lb` doesn't "remember" where its value came from,
it isn't automatically updated when `weight_kg` changes.
This is different from the way spreadsheets work.
You can use the `whos` command at any time to see what variables you have created and what modules you have loaded into your session:
~~~ {.python}
whos
~~~
~~~ {.output}
Variable Type Data/Info
--------------------------------
numpy module <module 'numpy' from '/Us<...>kages/numpy/__init__.py'>
weight_kg float 100.0
weight_lb float 126.5
~~~
Just as we can assign a single value to a variable, we can also assign an array of values
to a variable using the same syntax. Let's re-run `numpy.loadtxt` and save its result:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment