这是用户在 2024-3-17 2:25 为 http://localhost:8888/notebooks/Desktop/%E7%BC%96%E7%A8%8B%E8%80%83%E8%AF%953.25/%E7%BC%96%E7%A8%8B%... 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?
0

03_data_containers.ipynb

    1. Lecture 3: Data Containers
      1. Outline
      2. `String`: Container of `Char` Values
      3. Converting to `String`
      4. Converting from `String`
      5. `String` and Print Statements
      6. `Vector`: Container of Data Types
      7. The Dot `.` Syntax
      8. `String` vs. `Vector`: Similarities
      9. `String` vs. `Vector`: Differences
      10. `String` Concatenation and Interpolation
      11. The `push!` Function
      12. Summary: Looking Back and looking forward
Skip to Main 跳到主要
Jupyter

03_data_containers 03_数据_容器

Last Checkpoint: 4 months ago
最后检查点:4 个月前
  • File 文件
  • Edit 编辑
  • View 看法
  • Run
  • Kernel 核心
  • Settings 设置
  • Help 帮助
JupyterLab Jupyter实验室
Julia 1.9.3 朱莉娅1.9.3
Kernel status: Idle 内核状态:忙
    <img src="https://www.dpo.rwth-aachen.de/global/show_picture_asis.asp?id=aaaaaaaabftpwfx" width=200 height=200 align="left" /> <img src="https://www.dpo.rwth-aachen.de/global/show_picture_asis.asp?id=aaaaaaaabftpxde" width=200 height=200 align="right" />

    Image Image

    <h1><center> Introduction to Programming for Business Analytics </center></h1>

    <p style="text-align:left;">
    Murwan Siddig, Stefan Pilot
    </p>
    <a href="mailto:ipba@dpo.rwth-aachen.de">ipba@dpo.rwth-aachen.de</a> <br>

    Introduction to Programming for Business Analytics
    业务分析编程简介
    ¶

    Murwan Siddig, Stefan Pilot
    穆尔万·西迪格、斯特凡·派洛特

    ipba@dpo.rwth-aachen.de
    ## Lecture 3: Data Containers

    ---
    ### Outline
    - Strings
    - Vectors
    - Strings vs. Vectors

    Lecture 3: Data Containers¶
    第 3 讲:数据容器 ¶


    Outline¶ 大纲 ¶

    • Strings 弦乐
    • Vectors 向量
    • Strings vs. Vectors 字符串与向量
    ---
    ### `String`: Container of `Char` Values

    - A `Char` (short for character) is a data type that represents a single *glyph*, whitespace, and special control values.
    - **Glyphs** can be any letter, digit, or symbol.
    - To define a `Char` value in Julia we use single quotation delimeters `''`.

    **Examples:**

    String: Container of Char Values¶
    String : Char 值的容器 ¶

    • A Char (short for character) is a data type that represents a single glyph, whitespace, and special control values.
      Char (字符的缩写)是一种数据类型,表示单个字形、空格和特殊控制值。

      • Glyphs can be any letter, digit, or symbol.
        字形可以是任何字母、数字或符号。
    • To define a Char value in Julia we use single quotation delimeters ''.
      要在 Julia 中定义 Char 值,我们使用单引号分隔符 '' 。

    Examples: 例子:

    [1]: [1]:
    'A'
    [1]: [1]:
    'A': ASCII/Unicode U+0041 (category Lu: Letter, uppercase)
    [2]: [2]:
    typeof('A')
    [2]: [2]:
    Char
    [3]: [3]:
    '5'
    [3]: [3]:
    '5': ASCII/Unicode U+0035 (category Nd: Number, decimal digit)
    [4]: [4]:
    typeof('5')
    [4]: [4]:
    Char
    [5]: [5]:
    ' '
    [5]: [5]:
    ' ': ASCII/Unicode U+0020 (category Zs: Separator, space)
    [6]: [6]:
    typeof(' ')
    [6]: [6]:
    Char
    - We can also type **unicode characters** can be entered via *tab completion* of LaTeX-like abbreviations.
    - For example, to get the greek letter $\pi$ we write `\pi` and press and hold `TAB (⇥)`
    • We can also type unicode characters can be entered via tab completion of LaTeX-like abbreviations.
      我们还可以通过类似 LaTeX 的缩写的制表符补全来输入 unicode 字符。
    • For example, to get the greek letter π we write \pi and press and hold TAB (⇥)
      例如,要获取希腊字母 π ,我们写 \pi 并按住 TAB (⇥)
    [7]: [7]:
    'π'
    [7]: [7]:
    'π': Unicode U+03C0 (category Ll: Letter, lowercase)
    [8]: [8]:
    typeof('π')
    [8]: [8]:
    Char
    - A `String` is a container data type that contains a sequence of `Char` values.<br>
    $\implies$ `String` can represent arbitrary pieces of text.

    - A `String` literal is the string's value enclosed between delimiters `""`.

    **Examples:**
    • A String is a container data type that contains a sequence of Char values.
      String 是包含一系列 Char 值的容器数据类型。

      ⟹ String can represent arbitrary pieces of text.
      ⟹ String 可以表示任意文本片段。

    • A String literal is the string's value enclosed between delimiters "".
      String 文字是分隔符 "" 之间的字符串值。

    Examples: 例子:

    [9]: [9]:
    println("I am a String that contains \" as a character.")
    println("I am a String that contains \\ as a character.")
    I am a String that contains " as a character.
    I am a String that contains \ as a character.
    
    [10]: [10]:
    println("In the Julia code of the above examples, \\\"")
    println("and \\\\ are examples of what is known as an")
    println("escape sequence.")
    In the Julia code of the above examples, \"
    and \\ are examples of what is known as an
    escape sequence.
    
    [11]: [11]:
    print("We can also use escape sequences to repre-\nsent ")
    print("special values such as the linebreak or\nthe tab ")
    print("whitespace '\t'.\n")
    We can also use escape sequences to repre-
    sent special values such as the linebreak or
    the tab whitespace '	'.
    
    ---
    ### Converting to `String`

    - We can use the built-in function `string` to convert any Julia value to a `String`.

    Converting to String¶
    转换为 String ¶

    • We can use the built-in function string to convert any Julia value to a String.
      我们可以使用内置函数 string 将任何 Julia 值转换为 String 。
    [12]: [12]:
    # converting an Int64 to a String
    string(1)
    [12]: [12]:
    "1"
    [13]: [13]:
    # converting a BigInt to a String
    string(BigInt(2)^128)
    [13]: [13]:
    "340282366920938463463374607431768211456"
    [14]: [14]:
    # converting a Float64 to a String
    string(3.14)
    [14]: [14]:
    "3.14"
    [15]: [15]:
    # converting a Bool to a String
    string(-0.0 == 0.0)
    [15]: [15]:
    "true"
    ---
    ### Converting from `String`
    - We can also convert some `String`s into other data types using the built-in function `parse`.

    Converting from String¶
    从 String 转换 ¶

    • We can also convert some Strings into other data types using the built-in function parse.
      我们还可以使用内置函数 parse 将一些 String 转换为其他数据类型。
    [16]: [16]:
    parse(Int64, "1")
    [16]: [16]:
    1
    [17]: [17]:
    parse(BigInt,"340282366920938463463374607431768211456")
    [17]: [17]:
    340282366920938463463374607431768211456
    [18]: [18]:
    parse(Float64, "3.14")
    [18]: [18]:
    3.14
    [19]: [19]:
    parse(Bool, "false")
    [19]: [19]:
    false
    ---
    ### `String` and Print Statements

    - `String` values are very useful inside of a print statement.
    - In the following example, we include a `String` value in the print statement to display what is being calculated and the result of the calculation in the same line.

    String and Print Statements¶
    String 和打印语句 ¶

    • String values are very useful inside of a print statement.
      String 值在 print 语句中非常有用。
    • In the following example, we include a String value in the print statement to display what is being calculated and the result of the calculation in the same line.
      在下面的示例中,我们在 print 语句中包含一个 String 值,以在同一行中显示正在计算的内容和计算结果。
    [20]: [20]:
    x = 3;
    y = 1;
    println("x+y= ", x+y)
    x+y= 4
    
    **Note:**
    - The comma `,` between the string `"x+y= "` and the algebraic expression `x+y` is a delimiter.
    - We can have as many string representation and algebraic expression pair as we want.

    Note: 笔记:

    • The comma , between the string "x+y= " and the algebraic expression x+y is a delimiter.
      字符串 "x+y= " 和代数表达式 x+y 之间的逗号 , 是分隔符。
    • We can have as many string representation and algebraic expression pair as we want.
      我们可以拥有任意数量的字符串表示形式和代数表达式对。
    [21]: [21]:
    println("x+y= ", x+y, " and ", "x-y= ", x-y)
    x+y= 4 and x-y= 2
    
    ---
    ### `Vector`: Container of Data Types

    - A vector is a data *container* that may contain more than one value of any data types.
    - Vectors are also very often referred to as **Arrays**.
    - In many programming languages, what is known in Julia as a `Vector` is called an *Array*.
    - In Julia, a `Vector` is a special case of the data type `Array`.
    - We will discuss the Julia data type `Array` later, in another lecture.
    - A vector literal is a comma-separated list of values inside the delimiters `[` and `]`.

    **Examples:**

    Vector: Container of Data Types¶
    Vector :数据类型容器 ¶

    • A vector is a data container that may contain more than one value of any data types.
      向量是一种数据容器,可以包含多个任意数据类型的值。
    • Vectors are also very often referred to as Arrays.
      向量也经常被称为数组。
      • In many programming languages, what is known in Julia as a Vector is called an Array.
        在许多编程语言中,Julia 中的 Vector 称为数组。
      • In Julia, a Vector is a special case of the data type Array.
        在 Julia 中, Vector 是数据类型 Array 的特例。
      • We will discuss the Julia data type Array later, in another lecture.
        我们将在稍后的另一场讲座中讨论 Julia 数据类型 Array 。
    • A vector literal is a comma-separated list of values inside the delimiters [ and ].
      向量文字是分隔符 [ 和 ] 内以逗号分隔的值列表。

    Examples: 例子:

    [22]: [22]:
    # an empty vector (array) of type Any
    []
    [22]: [22]:
    Any[]
    [23]: [23]:
    # a vector (array) containing 3 elements of the same type (Int64)
    example_vector = [1, 2, 3]
    [23]: [23]:
    3-element Vector{Int64}:
     1
     2
     3
    [24]: [24]:
    # a vector (array) containing 4 elements of different types (Any)
    [1.0, example_vector, "Hello!", []]
    [24]: [24]:
    4-element Vector{Any}:
     1.0
      [1, 2, 3]
      "Hello!"
      Any[]
    ---
    ### The Dot `.` Syntax

    For every *binary* operator like `+`, there is a corresponding **dot operator** `.+` that is automatically defined to perform (broadcast) `+` *element-by-element* on vectors.

    **Examples:**

    The Dot . Syntax¶
    点 . 语法 ¶

    For every binary operator like +, there is a corresponding dot operator .+ that is automatically defined to perform (broadcast) + element-by-element on vectors.
    对于像 + 这样的每个二元运算符,都有一个相应的点运算符 .+ ,它被自动定义为在向量上逐个元素地执行(广播) + 。

    Examples: 例子:

    [25]: [25]:
    data1 = [1, 2, 3];
    data2 = [3, 2, 1];
    - **Scalar** addition, subtraction, multiplication, division and exponentiation:
    • Scalar addition, subtraction, multiplication, division and exponentiation:
      标量加、减、乘、除和幂:
    [26]: [26]:
    println("data1 .+ 2 = ", data1 .+ 2) # scalar addition
    println("data1 .- 2 = ", data1 .- 2) # scalar subtraction
    println("data1 .* 2 = ", data1 .* 2) # scalar multiplication
    println("data1 ./ 2 = ", data1 ./ 2) # scalar division
    println("data1 .^ 2 = ", data1 .^ 2) # scalar exponentiation
    data1 .+ 2 = [3, 4, 5]
    data1 .- 2 = [-1, 0, 1]
    data1 .* 2 = [2, 4, 6]
    data1 ./ 2 = [0.5, 1.0, 1.5]
    data1 .^ 2 = [1, 4, 9]
    
    - **Vector elementwise** addition, subtraction, multiplication, division and exponentiation:
    • Vector elementwise addition, subtraction, multiplication, division and exponentiation:
      向量元素加法、减法、乘法、除法和求幂:
    [27]: [27]:
    println("data1 .+ data2 = ", data1 .+ data2) # vector elementwise addition
    println("data1 .- data2 = ", data1 .- data2) # vector elementwise subtraction
    println("data1 .* data2 = ", data1 .* data2) # vector elementwise multiplication
    println("data1 ./ data2 = ", data1 ./ data2) # vector elementwise division
    println("data1 .^ data2 = ", data1 .^ data2) # vector elementwise exponentiation
    data1 .+ data2 = [4, 4, 4]
    data1 .- data2 = [-2, 0, 2]
    data1 .* data2 = [3, 4, 3]
    data1 ./ data2 = [0.3333333333333333, 1.0, 3.0]
    data1 .^ data2 = [1, 4, 3]
    
    - Any (built-in and user-defined) **function** can be applied *elementwise* to any (compatible) vector with the dot `.` syntax.
    • Any (built-in and user-defined) function can be applied elementwise to any (compatible) vector with the dot . syntax.
      任何(内置和用户定义)函数都可以使用点 . 语法按元素应用于任何(兼容)向量。
    [28]: [28]:
    sqrt.([4, 9, 16])
    [28]: [28]:
    3-element Vector{Float64}:
     2.0
     3.0
     4.0
    [29]: [29]:
    typeof.([1, 999999999999999999999999999999999999999, 3.14, true, "IPBA", []])
    [29]: [29]:
    6-element Vector{DataType}:
     Int64
     BigInt
     Float64
     Bool
     String
     Vector{Any} (alias for Array{Any, 1})
    [30]: [30]:
    debit(t)=15000*(1+0.04)^t;
    periods = [6,8,10];
    [31]: [31]:
    debit.(periods)
    [31]: [31]:
    3-element Vector{Float64}:
     18979.785277440005
     20528.53575607911
     22203.664273775164
    ---
    ### `String` vs. `Vector`: Similarities

    `String`s and `Vector`s share many characteristics.
    - Values inside of vectors and strings are stored sequentially.
    - Every value is associated with a position.
    - Positions are associated with numbers referred to as indices (plural for *index*).
    - Values can be retrieved using their index (i.e., the position's number).
    - To retrieve a value from a `String` or `Vector`, we pass the index of the position to the *bracket operator*.

    **Examples:**

    String vs. Vector: Similarities¶
    String 与 Vector :相似之处 ¶

    Strings and Vectors share many characteristics.
    String 和 Vector 有许多共同特征。

    • Values inside of vectors and strings are stored sequentially.
      向量和字符串内部的值是按顺序存储的。
      • Every value is associated with a position.
        每个值都与一个位置相关联。
      • Positions are associated with numbers referred to as indices (plural for index).
        头寸与称为指数(指数的复数形式)的数字相关联。
      • Values can be retrieved using their index (i.e., the position's number).
        可以使用索引(即位置编号)检索值。
    • To retrieve a value from a String or Vector, we pass the index of the position to the bracket operator.
      要从 String 或 Vector 检索值,我们将位置索引传递给括号运算符。

    Examples: 例子:

    [32]: [32]:
    my_vector = [6, 5, 4, 3, 2, 1]
    my_string = "Hello, world!";
    [33]: [33]:
    my_vector[1]
    [33]: [33]:
    6
    [34]: [34]:
    my_vector[4]
    [34]: [34]:
    3
    [35]: [35]:
    my_vector[end]
    [35]: [35]:
    1
    [36]: [36]:
    my_string[1]
    [36]: [36]:
    'H': ASCII/Unicode U+0048 (category Lu: Letter, uppercase)
    [37]: [37]:
    my_string[-10 + 14]
    [37]: [37]:
    'l': ASCII/Unicode U+006C (category Ll: Letter, lowercase)
    [38]: [38]:
    my_string[end-2]
    [38]: [38]:
    'l': ASCII/Unicode U+006C (category Ll: Letter, lowercase)
    Instead of single numbers, we can also pass a *range* $\rightarrow$ this is known as **slicing** (i.e., we take a *slice*).
    **Examples:**

    Instead of single numbers, we can also pass a range → this is known as slicing (i.e., we take a slice).
    除了单个数字之外,我们还可以传递一个范围 → 这称为切片(即,我们取一个切片)。

    Examples: 例子:

    [39]: [39]:
    my_vector[2:4]
    [39]: [39]:
    3-element Vector{Int64}:
     5
     4
     3
    [40]: [40]:
    my_string[2:end-1]
    [40]: [40]:
    "ello, world"
    [41]: [41]:
    length([])
    [41]: [41]:
    0
    [42]: [42]:
    length("hello")
    [42]: [42]:
    5
    ---
    ### `String` vs. `Vector`: Differences

    - We can change the values contained in a `Vector`, but not the values contained in a `String`.<br>
    $\implies$ a `String` is an **immutable** data type.<br>
    $\implies$ a `Vector` is a **mutable** data type.<br>

    String vs. Vector: Differences¶
    String 与 Vector :差异 ¶

    • We can change the values contained in a Vector, but not the values contained in a String.
      我们可以更改 Vector 中包含的值,但不能更改 String 中包含的值。

      ⟹ a String is an immutable data type.
      ⟹ a String 是不可变的数据类型。

      ⟹ a Vector is a mutable data type.
      ⟹ a Vector 是可变数据类型。

    [43]: [43]:
    word1 = "Hello, ";
    word2 = "vorld!";
    - If we try to mutate a `String` an error will be raised.
    • If we try to mutate a String an error will be raised.
      如果我们尝试改变 String 则会引发错误。
    [44]: [44]:
    word2[2] = '1'
    MethodError: no method matching setindex!(::String, ::Char, ::Int64)
    
    Stacktrace:
     [1] top-level scope
       @ In[44]:1
    [45]: [45]:
    vector_we_mutate = [3, 10]
    vector_we_mutate[2] = 4
    println(vector_we_mutate)
    [3, 4]
    
    ----
    ### `String` Concatenation and Interpolation

    String Concatenation and Interpolation¶
    String 连接和插值 ¶

    - We can *concatenate* two `String`s using the `*` operator.
    • We can concatenate two Strings using the * operator.
      我们可以使用 * 运算符连接两个 String 。
    [46]: [46]:
    word1 = "Hello, ";
    word2 = "vorld!";
    greeting = word1 * "w" * word2[2:end]
    [46]: [46]:
    "Hello, world!"
    [47]: [47]:
    part1 = "We have said \"Hello, world!\" "
    part2 = string(3)
    part3 = " times in this lecture!"
    println(part1 * part2 * part3)
    We have said "Hello, world!" 3 times in this lecture!
    
    - We can *interpolate* into a `String` using the `$` operator.
    • We can interpolate into a String using the $ operator.
      我们可以使用 $ 运算符插入 String 中。
    [48]: [48]:
    println("Here is the $(string(4))th time: $greeting")
    Here is the 4th time: Hello, world!
    
    ---
    ### The `push!` Function
    - A very useful built-in function for working with vectors is the `push!` function.
    - The `push!` can be used to insert one or more items at the end of the vector.

    The push! Function¶  push! 函数 ¶

    • A very useful built-in function for working with vectors is the push! function.
      push! 函数是处理向量的一个非常有用的内置函数。
    • The push! can be used to insert one or more items at the end of the vector.
      push! 可用于在向量末尾插入一项或多项。
    [49]: [49]:
    vector_we_push_into = [3,4];
    push!(vector_we_push_into, 7)
    println(vector_we_push_into)
    [3, 4, 7]
    
    [50]: [50]:
    push!(vector_we_push_into, 11,18,29)
    println(vector_we_push_into)
    [3, 4, 7, 11, 18, 29]
    
    **Note:** A stylistic convention in the Julia language is' to indicate any function that changes at least one of their arguments by using ! as the last character in its name.

    Note: A stylistic convention in the Julia language is' to indicate any function that changes at least one of their arguments by using ! as the last character in its name.
    注意:Julia 语言中的一种风格约定是 ' 来指示任何使用 ! 更改至少一个参数的函数。作为其名称的最后一个字符。

    ---
    ### Summary: Looking Back and looking forward

    **Looking Back:**
    - **`String`:** a set of characters for representing *text*.
    - Strings are made up of characters (`Char`).
    - A `Char` (short for character) is a data type that represents a single *glyph*, whitespace, and special control values.
    - **`Vector`:** a data *container* that may contain more than one value.
    - Vectors are mutable but strings are immutable.
    - The dot syntax performs *element-by-element* operations on vectors.

    **Looking Forward:**
    - How can we use these different data types in a meaningful context.
    - The *conditional execution* and *repetition* parts of a program.

    Summary: Looking Back and looking forward¶
    摘要:回顾与展望 ¶

    Looking Back: 回头看:

    • String: a set of characters for representing text.
      String :表示文本的一组字符。
    • Strings are made up of characters (Char).
      字符串由字符 ( Char ) 组成。
    • A Char (short for character) is a data type that represents a single glyph, whitespace, and special control values.
      Char (字符的缩写)是一种数据类型,表示单个字形、空格和特殊控制值。
    • Vector: a data container that may contain more than one value.
      Vector :可能包含多个值的数据容器。
    • Vectors are mutable but strings are immutable.
      向量是可变的,但字符串是不可变的。
    • The dot syntax performs element-by-element operations on vectors.
      点语法对向量执行逐元素运算。

    Looking Forward: 期待:

    • How can we use these different data types in a meaningful context.
    • The conditional execution and repetition parts of a program.
    [ ]:

    -

    Variables

    Callstack

      Breakpoints

      Source

      9
      1

      Kernel Sources

      Common Tools
      No metadata.
      Advanced Tools
      No metadata.
      ⌥ [
      ⌥ ]
      ⌥ ↘
      • Console
      • Change Kernel…
      • Clear Console Cells
      • Close and Shut Down…
      • Insert Line Break
      • Interrupt Kernel
      • New Console
      • Restart Kernel…
      • Run Cell (forced)
      • Run Cell (unforced)
      • Show All Kernel Activity
      • Debugger
      • Breakpoints on exception
      • Evaluate Code
        Evaluate Code
      • Next
        Next
        F10
      • Pause
        Pause
        F9
      • Step In
        Step In
        F11
      • Step Out
        Step Out
        ⇧ F11
      • Terminate
        Terminate
        ⇧ F9
      • Display Languages
      • English
        English
      • File Operations
      • Autosave Documents
      • Download
        Download the file to your computer
      • Reload Notebook from Disk
        Reload contents from disk
      • Revert Notebook to Checkpoint…
        Revert contents to previous checkpoint
      • Save Notebook
        Save and create checkpoint
        ⌘ S
      • Save Notebook As…
        Save with new path
        ⇧ ⌘ S
      • Trust HTML File
        Whether the HTML file is trusted. Trusting the file allows scripts to run in it, which may result in security risks. Only enable for files you trust.
      • Help
      • About Jupyter Notebook
      • Jupyter Reference
      • JupyterLab FAQ
      • JupyterLab Reference
      • Launch Jupyter Notebook File Browser
      • Markdown Reference
      • Show Keyboard Shortcuts
        Show relevant keyboard shortcuts for the current active widget
        ⇧ ⌘ H
      • Image Viewer
      • Flip image horizontally
        H
      • Flip image vertically
        V
      • Invert Colors
        I
      • Reset Image
        0
      • Rotate Clockwise
        ]
      • Rotate Counterclockwise
        [
      • Zoom In
        =
      • Zoom Out
        -
      • Kernel Operations
      • Shut Down All Kernels…
      • Main Area
      • Close All Other Tabs
      • Close Tab
        ⌥ W
      • Close Tabs to Right
      • End Search
        ⎋
      • Find Next
        ⌘ G
      • Find Previous
        ⇧ ⌘ G
      • Find…
        ⌘ F
      • Log Out
        Log out of JupyterLab
      • Search in Selection
        ⌥ L
      • Shut Down
        Shut down JupyterLab
      • Mode
      • Toggle Zen Mode
      • Notebook Cell Operations
      • Change to Code Cell Type
        Y
      • Change to Heading 1
        1
      • Change to Heading 2
        2
      • Change to Heading 3
        3
      • Change to Heading 4
        4
      • Change to Heading 5
        5
      • Change to Heading 6
        6
      • Change to Markdown Cell Type
        M
      • Change to Raw Cell Type
        R
      • Clear Cell Output
        Clear outputs for the selected cells
      • Collapse All Code
      • Collapse All Outputs
      • Collapse Selected Code
      • Collapse Selected Outputs
      • Copy Cell
        Copy this cell
        C
      • Cut Cell
        Cut this cell
        X
      • Delete Cell
        Delete this cell
        D, D
      • Disable Scrolling for Outputs
      • Enable Scrolling for Outputs
      • Expand All Code
      • Expand All Outputs
      • Expand Selected Code
      • Expand Selected Outputs
      • Extend Selection Above
        ⇧ K
      • Extend Selection Below
        ⇧ J
      • Extend Selection to Bottom
        ⇧ ↘
      • Extend Selection to Top
        ⇧ ↖
      • Insert Cell Above
        Insert a cell above
        A
      • Insert Cell Below
        Insert a cell below
        B
      • Insert Heading Above Current Heading
        ⇧ A
      • Insert Heading Below Current Heading
        ⇧ B
      • Merge Cell Above
        ⌃ ⌫
      • Merge Cell Below
        ⌃ ⇧ M
      • Merge Selected Cells
        ⇧ M
      • Move Cell Down
        Move this cell down
        ⌃ ⇧ ↓
      • Move Cell Up
        Move this cell up
        ⌃ ⇧ ↑
      • Paste Cell Above
        Paste this cell from the clipboard
      • Paste Cell and Replace
      • Paste Cell Below
        Paste this cell from the clipboard
        V
      • Redo Cell Operation
        ⇧ Z
      • Render Side-by-Side
        ⇧ R
      • Run Selected Cell
        Run this cell and advance
        ⇧ ⏎
      • Run Selected Cell and Do not Advance
        ⌘ ⏎
      • Run Selected Cell and Insert Below
        ⌥ ⏎
      • Run Selected Text or Current Line in Console
      • Select Cell Above
        K
      • Select Cell Below
        J
      • Select Heading Above or Collapse Heading
        ←
      • Select Heading Below or Expand Heading
        →
      • Set side-by-side ratio
      • Split Cell
        ⌃ ⇧ -
      • Undo Cell Operation
        Z
      • Notebook Operations
      • Access Next Kernel History Entry
        ⌥ ↓
      • Access Previous Kernel History Entry
        ⌥ ↑
      • Change Kernel…
      • Clear Outputs of All Cells
        Clear all outputs of all cells
      • Close and Shut Down Notebook
      • Collapse All Headings
        ⌃ ⇧ ←
      • Deselect All Cells
      • Edit Notebook Metadata
      • Enter Command Mode
        ⌃ M
      • Enter Edit Mode
        ⏎
      • Expand All Headings
        ⌃ ⇧ →
      • Interrupt Kernel
        Interrupt the kernel
      • New Console for Notebook
      • New Notebook
        Create a new notebook
      • Reconnect to Kernel
      • Render All Markdown Cells
      • Restart Kernel and Clear Outputs of All Cells…
        Restart the kernel and clear all outputs of all cells
      • Restart Kernel and Debug…
        Restart Kernel and Debug…
      • Restart Kernel and Run All Cells…
        Restart the kernel and run all cells
      • Restart Kernel and Run up to Selected Cell…
      • Restart Kernel…
        Restart the kernel
      • Run All Above Selected Cell
      • Run All Cells
        Run all cells
      • Run Selected Cell and All Below
      • Save and Export Notebook: Asciidoc
      • Save and Export Notebook: Executable Script
      • Save and Export Notebook: HTML
      • Save and Export Notebook: LaTeX
      • Save and Export Notebook: Markdown
      • Save and Export Notebook: PDF
      • Save and Export Notebook: Qtpdf
      • Save and Export Notebook: Qtpng
      • Save and Export Notebook: ReStructured Text
      • Save and Export Notebook: Reveal.js Slides
      • Save and Export Notebook: Webpdf
      • Select All Cells
        ⌘ A
      • Show Line Numbers
      • Toggle Collapse Notebook Heading
      • Trust Notebook
      • Other
      • Open in JupyterLab
        JupyterLab
      • Plugin Manager
      • Advanced Plugin Manager
      • Terminal
      • Decrease Terminal Font Size
      • Increase Terminal Font Size
      • New Terminal
        Start a new terminal session
      • Refresh Terminal
        Refresh the current terminal session
      • Use Terminal Theme: Dark
        Set the terminal theme
      • Use Terminal Theme: Inherit
        Set the terminal theme
      • Use Terminal Theme: Light
        Set the terminal theme
      • Text Editor
      • Decrease Font Size
      • Increase Font Size
      • New Julia File
        Create a new Julia file
      • New Markdown File
        Create a new markdown file
      • New Python File
        Create a new Python file
      • New Text File
        Create a new text file
      • Spaces: 1
      • Spaces: 2
      • Spaces: 4
      • Spaces: 4
      • Spaces: 8
      • Theme
      • Decrease Code Font Size
      • Decrease Content Font Size
      • Decrease UI Font Size
      • Increase Code Font Size
      • Increase Content Font Size
      • Increase UI Font Size
      • Set Preferred Dark Theme: JupyterLab Dark
      • Set Preferred Dark Theme: JupyterLab Light
      • Set Preferred Light Theme: JupyterLab Dark
      • Set Preferred Light Theme: JupyterLab Light
      • Synchronize Styling Theme with System Settings
      • Theme Scrollbars
      • Use Theme: JupyterLab Dark
      • Use Theme: JupyterLab Light
      • View
      • File Browser
      • Open JupyterLab
      • Show Debugger
        Show Show Debugger in the right sidebar
      • Show Header
      • Show Notebook Tools
        Show Show Notebook Tools in the right sidebar
      • Show Table of Contents
        Show Show Table of Contents in the left sidebar