You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/pairing.md
+15-13
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,8 @@ jupytext:
4
4
text_representation:
5
5
extension: .md
6
6
format_name: myst
7
-
format_version: 0.12
8
-
jupytext_version: 1.6.0
7
+
format_version: 0.13
8
+
jupytext_version: 1.11.1
9
9
kernelspec:
10
10
display_name: Python 3
11
11
language: python
@@ -16,7 +16,7 @@ kernelspec:
16
16
17
17
## What you'll do
18
18
This guide will keep a Jupyter notebook synced _or paired_ between
19
-
`.ipynb` and `.md`.
19
+
`.ipynb` and `.md`.
20
20
21
21
## What you'll learn
22
22
- The difference between Jupyter's json format and MyST-NB's markdown
@@ -44,15 +44,15 @@ format.
44
44
Jupyter notebooks are stored on your disk in a
45
45
[json format](https://nbformat.readthedocs.io/en/latest/format_description.html). The json format is
46
46
very powerful and allows you to store almost any input and output that
47
-
Python libraries can create. The drawback is that it is hard to see and compare changes made in the notebook file when reviewing pull requests, because this means the reviewers are looking only at the raw json files.
47
+
Python libraries can create. The drawback is that it is hard to see and compare changes made in the notebook file when reviewing pull requests, because this means the reviewers are looking only at the raw json files.
48
48
49
-
MyST-NB notebooks are stored on your disk in a
49
+
MyST-NB notebooks are stored on your disk in a
50
50
[markdown](https://en.wikipedia.org/wiki/Markdown) format. The markdown
51
51
format is a lightweight markup language. Its key design goal is
to save `x` and `y` in a comma separated value file, `x_y-squared.csv`.
155
155
The resulting csv is composed of ASCII characters. You can load the file
156
-
back into NumPy or read it with other programs.
156
+
back into NumPy or read it with other programs.
157
157
158
158
## Rearrange the data into a single 2D array
159
159
First, you have to create a single 2D array from your two 1D arrays. The
@@ -167,7 +167,7 @@ two NumPy functions to format the data:
167
167
168
168
2.[`np.newaxis`](https://numpy.org/doc/stable/reference/constants.html?highlight=newaxis#numpy.newaxis): this function forces the 1D array into a 2D column vector with 10 rows and 1 column.
When you saved the arrays to the csv file, you did not preserve the
245
-
`int` type. When loading the arrays back into your workspace the default process will be to load the csv file as a 2D floating point array e.g. `load_xy.dtype == 'float64'` and `load_xy.shape == (10, 2)`.
243
+
`int` type. When loading the arrays back into your workspace the default process will be to load the csv file as a 2D floating point array e.g. `load_xy.dtype == 'float64'` and `load_xy.shape == (10, 2)`.
246
244
247
245
+++
248
246
249
247
## Wrapping up
250
248
251
-
In conclusion, you can create, save, and load arrays in NumPy. Saving arrays makes sharing your work and collaboration much easier. There are other ways Python can save data to files, such as [pickle](https://docs.python.org/3/library/pickle.html), but `savez` and `savetxt` will serve most of your storage needs for future NumPy work and sharing with other people, respectively.
249
+
In conclusion, you can create, save, and load arrays in NumPy. Saving arrays makes sharing your work and collaboration much easier. There are other ways Python can save data to files, such as [pickle](https://docs.python.org/3/library/pickle.html), but `savez` and `savetxt` will serve most of your storage needs for future NumPy work and sharing with other people, respectively.
252
250
253
251
__Next steps__: you can import data with missing values from [Importing with genfromtext](https://numpy.org/devdocs/user/basics.io.genfromtxt.html) or learn more about general NumPy IO with [Reading and Writing Files](https://numpy.org/devdocs/user/how-to-io.html).
0 commit comments