YouTube2Text

GCI World 2026 September Session2 During Lecture — Transcript

by GCI World (Matsuo-Iwasawa Lab) · 7,188 words · 1,187 segments · language en · Watch on YouTube

Full transcript

  1. 0:00We will begin lecture two on a
  2. 0:25manage your data in Python. Then we will
  3. 0:28look at onedimensional.
  4. 0:31>> Just realized
  5. 0:33that you might
  6. 0:35not hearing the audio.
  7. 0:39Hold on a second. Sorry.
  8. 0:49How about this now?
  9. 0:57I think you can.
  10. 0:58>> We will begin lecture two on efficient
  11. 1:00data manipulation using non-fi.
  12. 1:03Throughout the next three lectures, we
  13. 1:06will look at different types of Python
  14. 1:08libraries that are often used for data
  15. 1:10science. This lecture will specifically
  16. 1:13focus on the NumPy library.
  17. 1:16First, I will introduce how to use NumPy
  18. 1:18to create ND array, a convenient and
  19. 1:21useful way to store and manage your data
  20. 1:24in Python. Then we will look at
  21. 1:26one-dimensional arrays to learn how
  22. 1:28numpy behaves such as universal
  23. 1:31functions that enable elementwise
  24. 1:33calculations without loops, broadcasting
  25. 1:36that allows operations on arrays of
  26. 1:38different shapes, aggregation functions
  27. 1:41to compute core statistics, and indexing
  28. 1:44that helps extracting individual values
  29. 1:46or entire subarrays for quick data
  30. 1:49reorganization or analysis. We will then
  31. 1:52look at the case of 2D arrays. When we
  32. 1:55extend to 2D, we will see how concepts
  33. 1:58such as axis and index specification
  34. 2:01become important.
  35. 2:03This class will focus on working with 1D
  36. 2:06and 2D arrays. We will not explore 3D or
  37. 2:10higher dimensional arrays this time and
  38. 2:12we'll skip more advanced topics like
  39. 2:15defining machine learning models or
  40. 2:17diving deep into linear algebra
  41. 2:19concepts.
  42. 2:21Before we get into Numpy, let's review
  43. 2:24some of the basics of Python grammar.
  44. 2:27First, variables were names that act as
  45. 2:30references to objects or values stored
  46. 2:32in memory. Whatever on the right side of
  47. 2:35the equals sign was stored into whatever
  48. 2:37was written on the left side of the
  49. 2:39sign, which can then be evaluated or
  50. 2:41referenced.
  51. 2:43Operators are symbols to indicate some
  52. 2:45kind of calculation between two
  53. 2:47variables. There are several types of
  54. 2:50operators such as arithmetic operators
  55. 2:52and comparison operators.
  56. 2:55Collections are a type of data structure
  57. 2:57that stores multiple values in some
  58. 3:00organized structure. Depending on the
  59. 3:02structure, it can be categorized into
  60. 3:05ordered management where order of the
  61. 3:07values matter such as lists and tpples
  62. 3:10and keyword management where order does
  63. 3:13not matter.
  64. 3:15In particular, a list is a type of data
  65. 3:18structure that stores multiple values in
  66. 3:21sequential order. Each value is assigned
  67. 3:24an index which indicates where the value
  68. 3:26is stored in that list.
  69. 3:28Two-dimensional lists can also be
  70. 3:30created as lists of lists. Similarly to
  71. 3:34lists, we can access specific values or
  72. 3:37elements by specifying the location
  73. 3:39using a process called indexing or
  74. 3:42slicing.
  75. 3:44Finally, for statements are a type of
  76. 3:46operation used to repeat the same
  77. 3:48process over multiple cases. What we
  78. 3:51loop over can be arbitrary. It can be
  79. 3:54some range, some list-like structure,
  80. 3:56and so on.
  81. 3:58Now, let's start by looking at what
  82. 4:00numpy is for and how to get started with
  83. 4:03it. Data mining is often described as a
  84. 4:06process to discover and extract valuable
  85. 4:09insights from large data sets. Christm
  86. 4:13is a framework which is used for smooth
  87. 4:15transition from understanding the
  88. 4:17business problem and the data itself
  89. 4:20through data preparation and modeling
  90. 4:23all the way to evaluation and expansion
  91. 4:26of our findings.
  92. 4:28The main goal here is to learn basic
  93. 4:30data manipulation using numpy so raw
  94. 4:33data can be transformed into a form that
  95. 4:36is ready for more advanced analyses
  96. 4:38later on.
  97. 4:40NumPy is a Python library suited for
  98. 4:43complex scientific computations. In
  99. 4:46Python, there are many kinds of
  100. 4:48libraries or collections of tools and
  101. 4:51functions that people can use to perform
  102. 4:53common tasks without having to write the
  103. 4:55code from scratch themselves. You can
  104. 4:58choose to use whichever library you want
  105. 5:00to use that best suits the task. Numpy
  106. 5:03is a library for handling large
  107. 5:05multi-dimensional arrays using a data
  108. 5:08structure named numpy.nd array using
  109. 5:11universal functions. It can handle
  110. 5:14intricate calculations without loops.
  111. 5:16Numpy is primarily written in C which
  112. 5:19makes its operations very fast.
  113. 5:22Additionally, NumPy also offers a broad
  114. 5:25range of functions for scientific
  115. 5:27computing. So plenty of tools are at our
  116. 5:30disposal for exploring and analyzing
  117. 5:32data. For example, we can simply write
  118. 5:35some equals a + b to add two arrays,
  119. 5:39which is much quicker than creating a
  120. 5:41new list, looping over every index, and
  121. 5:44appending the results. This simplicity
  122. 5:47means there will be less time to spend
  123. 5:49on repetitive tasks, and more time
  124. 5:51exploring the data.
  125. 5:54Now that we understand what numpy is,
  126. 5:56let's begin using it. As a convention,
  127. 5:59numpy is abbreviated as np, which makes
  128. 6:02the code shorter and easier to read. To
  129. 6:06import numpy into Python script, write
  130. 6:08import numpy as np. Using this
  131. 6:11abbreviation not only saves time when
  132. 6:14typing, but also helps keep the code
  133. 6:16clean and consistent.
  134. 6:19We can use NPI's functions by typing np
  135. 6:22followed by a dot and the function name
  136. 6:25then passing the object we want to
  137. 6:27process inside the parenthesis. For
  138. 6:29example, if we want to create an array,
  139. 6:32simply write array equals np.ray of 568.
  140. 6:38Here array is the function being used
  141. 6:41and 568 is the list converted into a
  142. 6:44numpy array. This straightforward syntax
  143. 6:47allows us to perform a wide range of
  144. 6:49operations on the data easily while
  145. 6:52making the code cleaner and more
  146. 6:54efficient.
  147. 6:56It's important to remember that
  148. 6:57functions are not something you need to
  149. 6:59memorize, but rather something you
  150. 7:01should look up when needed. Any library
  151. 7:04offers a vast array of functions to
  152. 7:06handle various tasks, and trying to
  153. 7:09remember all of them can be
  154. 7:10overwhelming. Instead, focus on
  155. 7:13understanding the core concepts and know
  156. 7:16how to efficiently find the functions
  157. 7:18you require. If there's a particular
  158. 7:20operation you'd like to try, don't
  159. 7:22hesitate to search for it in the
  160. 7:24official documentation or other reliable
  161. 7:27resources.
  162. 7:29Now, let's get into using numpy for 1D
  163. 7:31array.
  164. 7:37I'll just stop
  165. 7:39>> here moment and I think
  166. 7:44lot of you are facing that you cannot
  167. 7:48open this n book right I think yeah I
  168. 7:52wasn't able to open this book too so
  169. 7:56we're just figuring out um this issue at
  170. 8:01the moment so um
  171. 8:04out.
  172. 8:06Yeah. So, I'll just go back to the
  173. 8:07video, but um once that issue
  174. 8:12solves resolved, um I'll move on to the
  175. 8:16hands-on exercise.
  176. 8:20Before we dive into not by arrays, let's
  177. 8:23review Python's built-in data type
  178. 8:25called a list. A list is simply a
  179. 8:28collection of values enclosed in square
  180. 8:30brackets and separated by commas. For
  181. 8:33example, you can create a list like
  182. 8:36this. List A equals 0 1 2 3 4.
  183. 8:41While lists are versatile and easy to
  184. 8:43use, they aren't always the most
  185. 8:45efficient choice for numerical
  186. 8:47computations, especially when dealing
  187. 8:49with large data sets. This is where
  188. 8:52numpy arrays come into play. In numpy,
  189. 8:56arrays are handled using a data
  190. 8:58structure called numpy. Nd array. This
  191. 9:01ND array is similar to a list but is
  192. 9:04optimized for numerical computations and
  193. 9:07offers a lot more functions. To create
  194. 9:10an ND array, use the np.array function
  195. 9:13and pass in a list. For example, we can
  196. 9:17pass the list of from the previous slide
  197. 9:19to define it as an ND array. With this
  198. 9:22ND array, various nonby functions can be
  199. 9:25applied to perform efficient
  200. 9:27computations on the data. Let's take a
  201. 9:30closer look at how lists compare to
  202. 9:32nonpi.nd array. While a list in Python
  203. 9:35is versatile and can store different
  204. 9:37types of values, this flexibility can
  205. 9:40cause a drawback when performing
  206. 9:42numerical computations as operations
  207. 9:45between lists are often cumbersome and
  208. 9:48inefficient. In contrast, a numpy.nd ND
  209. 9:52array is designed to store elements of
  210. 9:54the same type which not only assists
  211. 9:57smooth arithmetic operations but also
  212. 10:00significantly enhance performance.
  213. 10:02Moreover, handling multi-dimensional
  214. 10:05data with lists requires nested
  215. 10:07structures that can quickly become
  216. 10:09complex and hard to manage. Numpy
  217. 10:13simplifies this process by efficiently
  218. 10:15managing multi-dimensional arrays
  219. 10:17through the concept of axes, allowing us
  220. 10:20to perform complex data manipulations
  221. 10:23with ease.
  222. 10:27Let's look at an example. Please open
  223. 10:30the notebook.
  224. 10:33Um, so I think
  225. 10:36that's not the best way, but I think I
  226. 10:39found a way to open the notebook. Um,
  227. 10:44which is if you um right click this
  228. 10:48notebook and open um click click open
  229. 10:52with and open in the new tab. I think
  230. 10:55you're able to
  231. 10:59open the notebook.
  232. 11:02Yeah. Yeah. I think that works. I'm not
  233. 11:05sure why you cannot
  234. 11:08um that ways. But um well now please um
  235. 11:13use that way to um open the notic.
  236. 11:17So, um I'll just
  237. 11:21um do a little bit of hands on for now.
  238. 11:27And
  239. 11:32so, um at the start, um you need to
  240. 11:36import the library we're using which is
  241. 11:39numpy. So um please click this um you
  242. 11:44need to run the cell
  243. 11:47do numpy
  244. 11:53and I think it should be working.
  245. 12:01Yeah.
  246. 12:04If you see this um green check mark,
  247. 12:07that means
  248. 12:10you're all good to go. And
  249. 12:16yeah, I
  250. 12:18And
  251. 12:19did we go?
  252. 12:26We are running a little bit out of time.
  253. 12:29So I'll
  254. 12:31go back to the lecture video for now.
  255. 12:34I'll coming back and
  256. 12:40like
  257. 12:41few minutes.
  258. 12:46First to handle numpy we need to import
  259. 12:50the library.
  260. 12:52There are two methods to import a
  261. 12:54library.
  262. 12:56You can import the entire library with
  263. 12:58an alias such as import library name as
  264. 13:01alias or you can import specific
  265. 13:04features from the library with from
  266. 13:06library name import feature name.
  267. 13:10Starting with the first method, it is
  268. 13:13common to import numpy with the alias.
  269. 13:16So we will import it this way.
  270. 13:21You can also import specific modules or
  271. 13:23functions from a certain library. To do
  272. 13:26so you can write from library name
  273. 13:29import module name.
  274. 13:34Here we will import random module and
  275. 13:36linel module. Here linel stands for
  276. 13:40linear algebra.
  277. 13:45Now let's take a look at the code.
  278. 13:50First let's look at how to create a
  279. 13:52numpy and d array. Any list-like
  280. 13:55structure such as Python lists and
  281. 13:57tpples can be converted into nonpendd
  282. 14:00array using ep.array function. Take a
  283. 14:03look at the example. We first define a
  284. 14:06Python list and then convert it to array
  285. 14:09using np.ray.
  286. 14:14To convert the nd array back to list, we
  287. 14:17can use the to list method. If a is a nd
  288. 14:20array, we write a do.to to list to
  289. 14:23convert it back to Python list.
  290. 14:28Before we dive further, let me explain
  291. 14:30some key aspects of numpy.
  292. 14:36Why is numpy so good at dealing with
  293. 14:37arrays? This is because numpai's
  294. 14:40functions are universal.
  295. 14:43Universal functions or efk in numpy are
  296. 14:47essential for performing elementwise
  297. 14:49operations on arrays. A EUK operates on
  298. 14:52each element of a ND array, allowing you
  299. 14:56to execute calculations efficiently
  300. 14:58without writing explicit loops. For
  301. 15:01example, if you have two arrays A and B,
  302. 15:05adding them together using A + B will
  303. 15:08produce a new array where each element
  304. 15:10is the sum of the corresponding elements
  305. 15:12in A and B. So if a is 24 and b is 21,
  306. 15:19the result will be 45.
  307. 15:22This operation is not only concise but
  308. 15:26also leverages namp's optimized
  309. 15:28performance because the plus operator
  310. 15:30automatically invokes the euunk and
  311. 15:33p.ab.
  312. 15:34The same principle applies to other
  313. 15:36arithmetic operations such as
  314. 15:39subtraction and multiplication.
  315. 15:42For other arithmetic operations, it
  316. 15:45would look something like this where
  317. 15:47different eupk are called for each
  318. 15:49operation.
  319. 15:51Implementing the code would look like
  320. 15:52this.
  321. 15:54Numpai offers a wide range of functions
  322. 15:56from exponential functions to
  323. 15:58trigonometric functions and much more.
  324. 16:01By leveraging these functions, we can
  325. 16:04handle a wide range of mathematical
  326. 16:06operations seamlessly, making the data
  327. 16:09processing tasks more streamlined and
  328. 16:12effective.
  329. 16:13Compare this with elementwise addition
  330. 16:16using Python lists. When you use the
  331. 16:19plus operator between two lists, it
  332. 16:21doesn't add the corresponding elements
  333. 16:23together. Instead, it concatenates the
  334. 16:26lists, combining them into a single
  335. 16:29list. That means that for addition you
  336. 16:32need to use a for loop instead making
  337. 16:34the code cumbersome. Moreover, trying to
  338. 16:37use other arithmetic operators like
  339. 16:39minus times or divide with lists will
  340. 16:43lead to errors. In contrast, with numpy
  341. 16:46arrays, these operations are
  342. 16:49straightforward and efficient thanks to
  343. 16:51universal functions.
  344. 16:56Let's go back to the notebook.
  345. 17:01To get ourselves more familiarized with
  346. 17:04NumPy, we will actually look at a
  347. 17:06publicly available data set and do
  348. 17:09simple analysis using NumPy.
  349. 17:13We will use a sample data set from Noah
  350. 17:15which contains data of daily temperature
  351. 17:18and precipitation recorded at one of the
  352. 17:21weather observing stations. The data is
  353. 17:24structured in 2D table format. Each row
  354. 17:27represents one entry of data and each
  355. 17:30column represents an attribute of that
  356. 17:32data such as station name, elevation,
  357. 17:35latitude and longitude, recorded date
  358. 17:39and recorded data. In this data set,
  359. 17:42three data are recorded. Maximum
  360. 17:45temperature, minimum temperature, and
  361. 17:47precipitation per day.
  362. 17:51We will load the data set using a nonby
  363. 17:53function enthy.load load txt function.
  364. 17:56Running the cell will download data and
  365. 17:59store it as variable raw.
  366. 18:04In the first half of this lecture, we
  367. 18:06will only use the data from the first
  368. 18:08week. Run the cell to select only the
  369. 18:11data from the first week. We will store
  370. 18:14the data as week 1 t-max, week 1 t-min
  371. 18:17and week 1 PRCP.
  372. 18:23Like Python lists, the length of an
  373. 18:25onedimensional array can be obtained
  374. 18:27using len function. A more common way in
  375. 18:30numpy is to access the shape attribute
  376. 18:34which returns the length per dimension
  377. 18:36of the array in array format.
  378. 18:42Now let's look at some numpy functions
  379. 18:44using the data set. For example, the
  380. 18:47temperature and precipitation are
  381. 18:49measured in t of degrees and t of
  382. 18:53millime respectively. However, it is
  383. 18:56more common to convert them to celsius
  384. 18:59and millime respectively. We can do so
  385. 19:02by dividing the array by 10. For
  386. 19:04example, running week 1 tmax /10 will
  387. 19:08divide each value in the array. Run the
  388. 19:11code and you will see how the operation
  389. 19:13is universal.
  390. 19:18We can then calculate the temperature
  391. 19:19range. Week one t-max minus week 1 t
  392. 19:23min.
  393. 19:27Other functions such as max, sum, mean,
  394. 19:30and standard deviation are also
  395. 19:33implemented in numpy.
  396. 19:38One point to note is that numpy treats
  397. 19:40division by zero slightly differently.
  398. 19:43In standard Python, trying to divide a
  399. 19:46number by zero led to zero division
  400. 19:48error.
  401. 19:52However, in numpy, this will result with
  402. 19:55an nd array of insf or epi. INF to be
  403. 20:00precise represents infinity. This means
  404. 20:03that although the code will not
  405. 20:05terminate, you may experience issues
  406. 20:07when trying to do further analysis using
  407. 20:09the returned array.
  408. 20:14Other math functions are also computed
  409. 20:17universally. For example, one can
  410. 20:20convert skewed data using a log
  411. 20:22function. Converting back is also
  412. 20:24universal.
  413. 20:29Now let's look at how NPI handles
  414. 20:31conditional operations with NDR. This is
  415. 20:39>> um so I want to look at
  416. 20:44the practice question in the notebook
  417. 20:49is
  418. 20:51practice question 2.1. So please open
  419. 20:56this section.
  420. 20:58Um in this question oh um what it's
  421. 21:01asking me is to create two
  422. 21:05one-dimensional np dot in the array
  423. 21:08arrays with a length of three with one
  424. 21:14with one with even numbers as elements
  425. 21:16and one with odd numbers elements then
  426. 21:20use the type function to confirm that
  427. 21:23they are type of mp in the array. So um
  428. 21:28here I don't know why
  429. 21:31done but um yeah so we want two arrays
  430. 21:37with even numbers and odd numbers so
  431. 21:41we're just going to call it a even
  432. 21:47this suggestion generative AI is um she
  433. 21:51sent me as but um yeah Um
  434. 21:56going to make it red.
  435. 22:00Yeah. So we're just going to call it
  436. 22:02even and odd and two four and six.
  437. 22:08One, three, and five.
  438. 22:11Then we can just try print it
  439. 22:17even and print
  440. 22:21print
  441. 22:22odd.
  442. 22:25So there it um it works fine and what
  443. 22:32it's also asking me is use the type
  444. 22:35function to confirm that they are type
  445. 22:37of um npd array. So want to print
  446. 22:45type
  447. 22:47even. So basically yeah
  448. 22:51let's see how it goes.
  449. 22:54Yeah, it's
  450. 22:56a numpy in the array type. So yeah, it
  451. 23:01works.
  452. 23:03It's just um
  453. 23:06just the basic and yeah.
  454. 23:11And the second question
  455. 23:16is add the two arrays that you created
  456. 23:19in number one and confirm that it
  457. 23:22results in element wise addition of the
  458. 23:26two arrays.
  459. 23:29So just we just need to add these.
  460. 23:34Yeah. Print
  461. 23:36try even plus odd and see how it goes.
  462. 23:44So yeah, it seems like it's working as a
  463. 23:50element wise edition.
  464. 23:52If we um try a Python list
  465. 23:58even
  466. 24:032 4 six
  467. 24:08I think they are talking about an N too
  468. 24:13right?
  469. 24:17Uh yeah.
  470. 24:20Um if you're curious, just try every
  471. 24:23time even and odd.
  472. 24:28I'm going to see how it goes in Python
  473. 24:32list
  474. 24:33that
  475. 24:36even plus odd.
  476. 24:41Yeah. So it works differently. Um you
  477. 24:44can see easily see the difference that
  478. 24:47for Python list which is above
  479. 24:52that one
  480. 24:54it's just adding the entire list.
  481. 24:57However, for numpy arrays, um it is
  482. 25:02adding the elements by elements 1 + 2 3
  483. 25:09and 4 + 3 7 and 6 + 5
  484. 25:1411. So yeah.
  485. 25:19And for number three,
  486. 25:22it is about um asking me to normalize
  487. 25:28um
  488. 25:32and
  489. 25:33output a one mention array that inputs
  490. 25:37normalized. And this question is a
  491. 25:40little bit um more complicated and I
  492. 25:43don't think I have a time to talk about
  493. 25:46in deeps but um
  494. 25:51what I can tell is um yeah you can give
  495. 25:54it a go if you curious always and
  496. 25:59it what it's asking me us is
  497. 26:05it's about a vector and
  498. 26:09you want to um
  499. 26:13you want to change the length of the
  500. 26:16vector, but you don't want to change its
  501. 26:20direction. So yeah,
  502. 26:23that's basically what it's um doing.
  503. 26:29Yeah. Oopsie.
  504. 26:35And then
  505. 26:37next section is about indexing. So I'm
  506. 26:40going to go back to texture video again.
  507. 26:46Also universal. For example, computing A
  508. 26:49equals to A will compare each element of
  509. 26:52A with itself resulting in true true.
  510. 26:55Similarly, A equals to B compares each
  511. 26:58corresponding pair of elements from A
  512. 27:01and B giving true false. A greater than
  513. 27:04B will return false true. These
  514. 27:07conditional operations are not only
  515. 27:09intuitive but also highly efficient,
  516. 27:12especially for quick filtering and
  517. 27:14analyzing data based on specific
  518. 27:17criteria.
  519. 27:19Again, compare this with conditional
  520. 27:21operation using Python lists. When using
  521. 27:24Python lists, the operation will
  522. 27:27evaluate the entire list and return a
  523. 27:30single boolean value.
  524. 27:33Next, I will explain broadcasting.
  525. 27:35Broadcasting is a powerful feature in
  526. 27:38NumPy to perform operations on arrays of
  527. 27:41different shapes by automatically
  528. 27:43adjusting their dimensions to be
  529. 27:44compatible. This means that when you add
  530. 27:47a scaler to an array, the scaler is
  531. 27:50extended to match the array's shape,
  532. 27:52enabling element-wise operations without
  533. 27:55the need for explicit loops. For
  534. 27:57instance, if you have an array A equals
  535. 28:0024 and you add a scalar 3, the result is
  536. 28:0357. This is because scalar 3 is extended
  537. 28:07into array 33. The same concept applies
  538. 28:11to multiplication as well as other
  539. 28:13operations.
  540. 28:15Aggregate functions are essential tools
  541. 28:18in NumPy to summarize the data within an
  542. 28:20array and to a single meaningful value.
  543. 28:24For example, if you have an array 1 2 3
  544. 28:27using npm max will return the maximum
  545. 28:29value of three. If you're looking to
  546. 28:32find the sum of all elements and pome
  547. 28:34will give you six. These aggregate
  548. 28:36functions enable you to quickly gain
  549. 28:39insights into your data.
  550. 28:44Now let's look at broadcasting in
  551. 28:46practice. If you try multiplying a
  552. 28:48scaler with a Python list, it will
  553. 28:51return an error. However, in numpy, the
  554. 28:54multiplication will be applied to each
  555. 28:57element. For example, if you do 2 * a,
  556. 29:01you will get the following result.
  557. 29:06This is equivalent to multiplying an
  558. 29:08array of twos.
  559. 29:13Note that broadcasting doesn't apply for
  560. 29:15all arrays. If you try multiplication
  561. 29:18between arrays with size five and size
  562. 29:21two, it will return an error. The length
  563. 29:24of either array must be one for
  564. 29:26broadcasting.
  565. 29:30Next, let's move on to another aspect of
  566. 29:33using numpy arrays, indexing, which is
  567. 29:36used to extract specific values from a
  568. 29:38numpy array. Suppose there is an array
  569. 29:41containing wind speed at some location
  570. 29:44measured every 30 minutes. We can ask
  571. 29:47some questions such as how can we
  572. 29:49extract data at a certain time? How can
  573. 29:52we extract data within a range? And how
  574. 29:54can we extract data every 60 minutes?
  575. 29:58All these questions can be answered
  576. 29:59using indexing.
  577. 30:02Just like in Python lists, each element
  578. 30:04in an ND array is assigned an index
  579. 30:07starting from zero on the left. To
  580. 30:09retrieve a particular value, simply
  581. 30:12specify its index within square
  582. 30:15brackets. For example, consider this
  583. 30:18array.
  584. 30:19Here the element three is at index one.
  585. 30:22By accessing A1, you obtain the value
  586. 30:25three. Like Python lists, NumPy supports
  587. 30:29negative indexing. Starting from the
  588. 30:32right end of the array, we can count
  589. 30:34minus1, minus2, and so on. This feature
  590. 30:39is particularly useful when you need to
  591. 30:41access elements relative to the end of
  592. 30:43the array which length may vary.
  593. 30:46You can also pass a list to specify
  594. 30:49multiple elements to retrieve from the
  595. 30:51array.
  596. 30:53Slicing is a type of indexing using
  597. 30:55colons. By specifying a slice in the
  598. 30:58format start colon end colon step, you
  599. 31:01can retrieve elements at regular
  600. 31:03intervals from the array. Here the start
  601. 31:06indicates the beginning index. The end
  602. 31:08marks the position where the slice stops
  603. 31:11and the step shows the interval between
  604. 31:13elements to extract. Note that the end
  605. 31:16index is exclusive. So that index is not
  606. 31:19included. In the example here, if you
  607. 31:22want to extract elements starting from
  608. 31:24index one up to index 7, taking every
  609. 31:27other element, you would use the slice 1
  610. 31:30col 7 2. This slice retrieves the
  611. 31:33elements three, 9, and 15.
  612. 31:37You can abbreviate the start, end, and
  613. 31:40step. For example, abbreviating the step
  614. 31:44will default to a step equal to one.
  615. 31:47If you abbreviate the end as well, it
  616. 31:50will continue slicing up to the last
  617. 31:52element.
  618. 31:54If you abbreviate the start, it will
  619. 31:56start slicing from the first element.
  620. 31:59If you only specify the step, it will
  621. 32:02slice the entire array at the specified
  622. 32:04step. Going back to the first quiz, if
  623. 32:08you want to extract the data at 1 p.m.,
  624. 32:10you can index as A2.
  625. 32:13If you want data between 1 p.m. and 4
  626. 32:16p.m., but excluding 4 p.m., you can
  627. 32:19index as A2 8. If you want to extract
  628. 32:23data every 60 minutes, you can index it
  629. 32:26as a colon 2.
  630. 32:31Now let's look at the notebook. Go to
  631. 32:34section 2.3. In this section, we will
  632. 32:37use only the data from January 2010.
  633. 32:44As we just saw, we use square brackets
  634. 32:47to retrieve elements from an array or
  635. 32:50slice an array. For example, we can
  636. 32:53access the t-max from January 1st with
  637. 32:56Jan Tmax 0. Keep in mind that the
  638. 32:59indexing in Python starts from zero.
  639. 33:05Using a negative number will retrieve
  640. 33:07elements counting from the end. For
  641. 33:10example, t-max from January 31st would
  642. 33:14be Jan Tax minus one.
  643. 33:19You can also retrieve multiple elements
  644. 33:22regardless of its order as well.
  645. 33:27Next, let's look at slicing. As we saw
  646. 33:30in the slides, slicing uses square
  647. 33:33brackets with three specifications. The
  648. 33:36start, end, and step index. For example,
  649. 33:40we can access the T-max from the first
  650. 33:43seven days using Jan Tmax 07
  651. 33:47and calculate the average maximum
  652. 33:49temperature.
  653. 33:53Also, we can look at precipitation on
  654. 33:56every Friday using genp0
  655. 33:59col 7.
  656. 34:04Let's move on to 2D arrays. We can
  657. 34:07actually reuse most of the concepts that
  658. 34:09we covered in 1D arrays.
  659. 34:12Just as we created a one-dimensional
  660. 34:14array earlier, a two-dimensional array
  661. 34:17can be formed by nesting lists within
  662. 34:19another list. This structure organizes
  663. 34:22data into rows and columns or in
  664. 34:25mathematical terms, matrices. Each row
  665. 34:28can represent a data entry and each
  666. 34:31column can represent an attribute. Note
  667. 34:34that in Python you can write with line
  668. 34:37breaks which helps improve readability
  669. 34:40especially with larger data sets.
  670. 34:43As you may have imagined universal
  671. 34:45functions in numpy are extended to
  672. 34:48n-dimensional arrays. This means that
  673. 34:50you can perform elementwise arithmetic
  674. 34:53operations on multi-dimensional data
  675. 34:55just as effortlessly as you do with
  676. 34:58one-dimensional arrays. For example,
  677. 35:00consider two 2D arrays A and B. When you
  678. 35:04add them together using A + B, NPI
  679. 35:07automatically adds each corresponding
  680. 35:09pair of elements, resulting in a new
  681. 35:12array where each element is the sum of
  682. 35:14the elements from A and B. This is the
  683. 35:18same for subtraction as well as other
  684. 35:20operations.
  685. 35:22Broadcasting is also applied just like
  686. 35:251D arrays. This means that when
  687. 35:27operating a scaler with a 2D array, the
  688. 35:31scaler is extended to match the array's
  689. 35:33shape. When you operate with a 2D array
  690. 35:36with one dimension of size one, it will
  691. 35:39extend in that direction to match the
  692. 35:41dimensions.
  693. 35:42If array is size 3x 1 and array B is
  694. 35:46size 2, then both arrays will be
  695. 35:48extended to match the dimensions of each
  696. 35:50other. This results in both arrays
  697. 35:53extended to shape 3x two. Understanding
  698. 35:56the concept of axis is essential when
  699. 35:59working with multi-dimensional arrays in
  700. 36:01numpy. An axis defines the direction
  701. 36:04along which operations are performed
  702. 36:06within an nd array.
  703. 36:09For example, consider a one-dimensional
  704. 36:12array like the one on the left. Since
  705. 36:14there's only one dimension, the axis is
  706. 36:17zero and any operation you perform will
  707. 36:20apply to the entire array. For a
  708. 36:23two-dimensional array like the one on
  709. 36:25the right, specifying axis zero means
  710. 36:28you are focusing on the rows.
  711. 36:31On the other hand, specifying axis one
  712. 36:34means the columns.
  713. 36:36This might be easier to understand when
  714. 36:38the arrays are written flat, especially
  715. 36:41for arrays with more than three
  716. 36:43dimensions.
  717. 36:47Aggregation is also almost the same for
  718. 36:50multi-dimensional arrays. The biggest
  719. 36:52difference is that arrays have more than
  720. 36:55one dimension. So you need to specify
  721. 36:57which dimension you want to apply the
  722. 36:59function. Imagine having a table where
  723. 37:01the rows represent subjects and the
  724. 37:04columns represent different students.
  725. 37:07You might wonder what are A and D's
  726. 37:09highest scores or what are the highest
  727. 37:11scores for each subject. Using
  728. 37:14aggregation functions, you can easily
  729. 37:16answer these questions if the dimension
  730. 37:19is specified correctly.
  731. 37:21If you just apply epmax, you will get
  732. 37:24the maximum score of all students in all
  733. 37:26subjects.
  734. 37:28With multi-dimensional arrays, you can
  735. 37:31specify the axis to operate the function
  736. 37:34using the axis argument by applying epax
  737. 37:37axis zero. Numpy performs aggregation
  738. 37:41column-wise and returns the highest
  739. 37:43score for each student.
  740. 37:46If you change to epimeax axis one, numpy
  741. 37:49examines each row individually and
  742. 37:51returns the highest score in each
  743. 37:54subject.
  744. 37:55This applies to other functions as well,
  745. 37:57such as calculating the minimum, sum,
  746. 38:00mean, standard deviation, and more.
  747. 38:07Now, let's return to the notebook. Go to
  748. 38:10section 2.4.
  749. 38:17Um, so I'm going to pause post a video
  750. 38:22moment and I want us to do a practice
  751. 38:27question again
  752. 38:29for question 2.2.
  753. 38:32Yeah. Before we further into the 2D
  754. 38:36arrays
  755. 38:38and the notebooks. Um and I think when
  756. 38:43I'm looking at these questions I think a
  757. 38:48lot of you
  758. 38:50finding little bit difficult and like
  759. 38:53fast and there I know there are a lot of
  760. 38:57information and I think you don't need
  761. 39:01to understand everything
  762. 39:04for now. Um I think it is very hard to
  763. 39:09just understand everything um just um
  764. 39:13listening one time. So um I recommend
  765. 39:17you to maybe try to understand
  766. 39:22the
  767. 39:25question number one level which is not
  768. 39:30that hard I find.
  769. 39:34And then you can um
  770. 39:37your buys um by watching recordings or
  771. 39:42um the slides.
  772. 39:46So yeah and in this question
  773. 39:50it's asking me to using the array
  774. 39:54January t-max that we built on the above
  775. 40:01create a new array
  776. 40:03T-max Monday month that contains the
  777. 40:07maximum temperatures of all Mondays in
  778. 40:11January.
  779. 40:12As mentioned previously, January 1st is
  780. 40:15a Friday, so um we don't really have a
  781. 40:20lot of time, so I'll keep it um
  782. 40:25fast. But
  783. 40:28assuming to create t-max,
  784. 40:31then what you need to
  785. 40:36think about in here is um this um AI is
  786. 40:40going to do it for me anyways. But um
  787. 40:43no, it's not what I want to do.
  788. 40:50You need to note that um in numpy I
  789. 40:55think it's in Python 2 um the index
  790. 40:58doesn't start from one. Yeah, that's
  791. 41:02step one point. So in in this case we
  792. 41:06want all the Mondays and then the f
  793. 41:10January 1st is start um starting from
  794. 41:14Friday. So it's Friday,
  795. 41:17Saturday, Sunday and Monday. So there is
  796. 41:20four
  797. 41:22days.
  798. 41:24So that um but you don't want to put
  799. 41:27four in here since it starts from zero.
  800. 41:30So 0 1 2 3. So you need to put three at
  801. 41:34first.
  802. 41:36then
  803. 41:38these um
  804. 41:44think you've covered in here is slicing.
  805. 41:47So for the rows um the next slicing row
  806. 41:51is for the end. So we don't need it for
  807. 41:55now.
  808. 41:56Then for the steps, the um last
  809. 42:01element, the steps, you want
  810. 42:06all the max temperatures of all Mondays.
  811. 42:09Therefore, you want it to make it to
  812. 42:14every week, right? So, left seven days.
  813. 42:19That's it. Oh, I think you need to run
  814. 42:23these all all these cells
  815. 42:27now, but it should be working.
  816. 42:35The next question, it's a little bit
  817. 42:37seems like a little bit difficult, but
  818. 42:41um it's not [clears throat] that hard.
  819. 42:44It's just asking me to calculate the
  820. 42:46average max temperature of all Monday in
  821. 42:49January and standard deviation of all
  822. 42:54max temperature of all Mondays in
  823. 42:56January. So, and that these hints um are
  824. 43:01talking about the standard deviation how
  825. 43:04do you the formula and how do you
  826. 43:07how what what is going on and something
  827. 43:09like that. But like when you're using
  828. 43:12Numpy, you can [snorts] skip these um
  829. 43:17steps by just using
  830. 43:20a
  831. 43:25I'm not sure where it covers but anyways
  832. 43:32you just you can just use the
  833. 43:37let me so for standard deviation.
  834. 43:40Standard deviation
  835. 43:43temperature
  836. 43:45max uh Monday
  837. 43:50Monday
  838. 43:53you can just use standard deviation
  839. 43:58then t-max Monday. So that that just
  840. 44:03gives an answer for this question.
  841. 44:08Um and that um works for
  842. 44:15average mean which is mean too. Um yeah
  843. 44:20so I'll move on to the lecture video.
  844. 44:25Here we will look at 2D arrays but the
  845. 44:28same thing applies to higher dimensional
  846. 44:30arrays as well.
  847. 44:32As explained, creating a 2D array in
  848. 44:35numpy is almost identical to creating a
  849. 44:381D array by using epi.array function.
  850. 44:42However, there is also a reshape
  851. 44:44function which allows you to resize your
  852. 44:46array in the way you like. For example,
  853. 44:49instead of defining a 3x 2 matrix from
  854. 44:52the beginning, you can first create a 1D
  855. 44:54array and then reshape into 3x two. Note
  856. 44:58that the total number of elements have
  857. 45:00to match before and after the reshaping.
  858. 45:06Another useful aspect of reshaping is
  859. 45:09that you do not need to specify all
  860. 45:10axes. For example, in the same example,
  861. 45:14if you specify the first axis to have
  862. 45:16three rows, you already know the other
  863. 45:19axis will have two columns because the
  864. 45:21total number of elements is six. So you
  865. 45:24can just write minus one and numpy will
  866. 45:27do the rest for you. Of course, if you
  867. 45:29try to specify the first axis to have
  868. 45:32four rows, it will return an error
  869. 45:34because six is not divisible by four.
  870. 45:39Let's move on to section 2.4.2.
  871. 45:42Here we will treat the entire Noah data
  872. 45:44set as a 2D array.
  873. 45:47Math operations are the same for 2D
  874. 45:50arrays. It will be applied elementwise.
  875. 45:53If we divide the data set by 10, this
  876. 45:56operation will be done universally.
  877. 46:02Move on to section 2.4.3.
  878. 46:08For multi-dimensional arrays, we call
  879. 46:11each dimension an axis. If the array is
  880. 46:142D, the first axis is the row and the
  881. 46:17second axis is the column.
  882. 46:20For different kinds of operations, you
  883. 46:23can specify the axis number to calculate
  884. 46:25that operation along a certain axis. For
  885. 46:28example, just ep.mminx will return the
  886. 46:32smallest number in the data set.
  887. 46:34However, writing np.mminxis0,
  888. 46:37we can access the lowest value for
  889. 46:40t-max, t min and prcp respectively.
  890. 46:47In such cases, the dimension of the
  891. 46:49array will be reduced. If you want to
  892. 46:52keep the dimensions as a 2D array, you
  893. 46:54set the keep dims argument to true.
  894. 46:58Now, let's return back to the slides.
  895. 47:02Continuing
  896. 47:04with this same example from before of a
  897. 47:072D array representing students scores in
  898. 47:10different subjects, let's explore how to
  899. 47:12extract specific elements using
  900. 47:14indexing. You might wonder what is
  901. 47:17student D's math grades or what are AB
  902. 47:20and C's grades in English and Spanish.
  903. 47:24For better understanding of indexing in
  904. 47:272D arrays, recall the flattened version
  905. 47:29of writing 2D arrays.
  906. 47:32To extract a specific element, you need
  907. 47:35to specify the index for all the axis.
  908. 47:38For 2D arrays, you need to pass two
  909. 47:41indexes separated by a comma. The first
  910. 47:44index will be used for the first axis or
  911. 47:47the row and the second index will be
  912. 47:49used for the second axis, the column.
  913. 47:52You can also use negative indexing as
  914. 47:55well. You can extract multiple elements
  915. 47:58along an axis by using slicing. For
  916. 48:01example, you can write a zero which is
  917. 48:04short for a zon to extract only the
  918. 48:07first row of the array. Recall how the
  919. 48:10colon was used for slicing 1D arrays. So
  920. 48:14a colon without any specification of
  921. 48:16start or end index means to take all the
  922. 48:19elements along that axis.
  923. 48:22Similarly, if you want to extract column
  924. 48:24one from the array, you would write a
  925. 48:26colon one. For axis one and more, you
  926. 48:29cannot abbreviate the colon.
  927. 48:32Finally, you can slice along multiple
  928. 48:35axis to extract consecutive elements. In
  929. 48:38this example, we are extracting elements
  930. 48:41up to index one along axis zero and all
  931. 48:44elements after index one along axis one
  932. 48:48resulting in 2x3 array.
  933. 48:51While basic indexing allows us to access
  934. 48:53elements using simple row and column
  935. 48:56numbers, there are times when we need to
  936. 48:58extract elements that are scattered
  937. 49:00across different positions within an
  938. 49:02array.
  939. 49:04Suppose we want to extract the elements
  940. 49:062 and 12 from this array. These elements
  941. 49:09are located at distinct positions. Two
  942. 49:12is in the first row, second column while
  943. 49:1512 is in the third row, fourth column.
  944. 49:18To achieve this, we can use advanced
  945. 49:20indexing.
  946. 49:22Depending on how we specify the indices,
  947. 49:24we could either extract them in a single
  948. 49:27row or column.
  949. 49:29When working with multi-dimensional
  950. 49:31data, there are specific rules that help
  951. 49:34us extract elements located at various
  952. 49:36positions efficiently.
  953. 49:39The first rule is axis- wise indexing,
  954. 49:42meaning we specify indices for each axis
  955. 49:45separately. In a two-dimensional array,
  956. 49:48this means providing one set of indices
  957. 49:50for the rows axis zero and another set
  958. 49:54for the columns axis one. The second
  959. 49:57rule shape and position preservation
  960. 50:00ensures that the structure of the output
  961. 50:03array matches the arrangement of the
  962. 50:05specified indices. This means that the
  963. 50:08extracted elements retain their relative
  964. 50:10positions based on how the indices were
  965. 50:12provided, maintaining the integrity of
  966. 50:15the data structure.
  967. 50:17Lastly, the rule of omitting notation
  968. 50:20encourages us to simplify our indexing
  969. 50:22expressions by leveraging NPI's
  970. 50:25broadcasting feature whenever possible.
  971. 50:28This allows for more concise and
  972. 50:30readable code. Let's look at each rule
  973. 50:33in more detail.
  974. 50:35The first rule axis wise indexing means
  975. 50:38that we pass the indexes as lists. One
  976. 50:41for axis 0 and another for index one and
  977. 50:45so forth. In the example 2 and 12 are
  978. 50:49located at index 01 and index 2 3
  979. 50:53respectively. We organize them so that
  980. 50:55the indexes are stored in separate lists
  981. 50:58for each access. As a result, a0213
  982. 51:03returns an array 212.
  983. 51:06The second rule ensures that the shape
  984. 51:08and positions of the elements in the
  985. 51:10output array align with the indices you
  986. 51:13provide. For example, consider changing
  987. 51:16the indexing of the previous example so
  988. 51:18that its shape is one by two array.
  989. 51:22Now the output shape is also size one
  990. 51:24two retaining the shape of the indexing.
  991. 51:28The third rule is omitting notation.
  992. 51:31Broadcasting applies to advanced
  993. 51:33indexing as well. So you can abbreviate
  994. 51:35the indexing to improve readability. For
  995. 51:38example, suppose we want to extract two
  996. 51:41non-consecutive elements along axis
  997. 51:43zero. We could specify axis zero for
  998. 51:46both elements, but we can just replace
  999. 51:49it with a single zero.
  1000. 51:52Similarly, if we want to extract four
  1001. 51:54elements as described in the slide, we
  1002. 51:57can abbreviate both the indexes of axis
  1003. 51:590 and one by shaping the index of axis 0
  1004. 52:03as a single column and the index of axis
  1005. 52:06one as a single row. Broadcasting will
  1006. 52:09handle this so that it automatically
  1007. 52:11aligns their shapes and returns an array
  1008. 52:14and 2x two shape.
  1009. 52:16Finally, of course, you can combine
  1010. 52:18basic indexing and advanced indexing to
  1011. 52:21extract elements from arrays in whatever
  1012. 52:24way you wish.
  1013. 52:26So, if we go back to the quick quiz from
  1014. 52:28earlier, the answer to the first
  1015. 52:30question will be indexing the array at
  1016. 52:3213. To extract A, B, and C's grades in
  1017. 52:37English and Spanish, we would combine
  1018. 52:40basic and advanced indexing as shown in
  1019. 52:43the slide.
  1020. 52:47Let's take a look at the notebook again.
  1021. 52:49Go to section 2.5.1.
  1022. 52:53Indexing for 2D arrays is the same as
  1023. 52:56indexing for 2D lists by using two
  1024. 52:59square brackets.
  1025. 53:03However, what's different is that you
  1026. 53:06can use just one bracket with commas to
  1027. 53:08extract a single element. Also, if you
  1028. 53:11want to extract several rows along a
  1029. 53:13certain axis, you need to use two square
  1030. 53:16brackets and a nested structure.
  1031. 53:22Next, let's move to section 2.5.2 to
  1032. 53:25look at some examples of advanced
  1033. 53:27indexing.
  1034. 53:31If we want to extract elements at 0 1
  1035. 53:33and 2 1, we can specify 0 and two along
  1036. 53:37axis 0 and one along axis one. Depending
  1037. 53:41how you write 0 and two, the output will
  1038. 53:44be either 2x one array or one by two
  1039. 53:46array.
  1040. 53:51Next, if we want to extract elements at
  1041. 53:532 1 and 2 3, we specify two along axis 0
  1042. 53:57and 1 and 3 along axis 1.
  1043. 54:04Now, if we want to extract elements at 0
  1044. 54:061, 03, 2, 1, and 2 3, we write 02 along
  1045. 54:12axis 0 and 1 3 along one. Here we will
  1046. 54:16need to be careful to write 02 as 2x 1
  1047. 54:20array and 1 3 as 1 by 2 array. If we for
  1048. 54:24example write both as a simple list it
  1049. 54:27will extract elements at 01 and 2 3.
  1050. 54:33Since this way of writing is complex
  1051. 54:36especially for higher dimensional arrays
  1052. 54:39there is a function called numpy x.
  1053. 54:45Next, let's move on to slicing. Again,
  1054. 54:48slicing in 2D is also similar to slicing
  1055. 54:51in 1D. For example, X 5 will return the
  1056. 54:56first five rows of X, the Noah data set.
  1057. 55:02We can retrieve T-max and T-min on a
  1058. 55:053day span using X col 32.
  1059. 55:12In multi-dimensional arrays, we can use
  1060. 55:15a single colon to skip a certain axis.
  1061. 55:18For example, to retrieve t min and prcp
  1062. 55:22for all rows, we write x col minus 2
  1063. 55:26colon.
  1064. 55:30Finally, let's talk about boolean
  1065. 55:32indexing. Boolean indexing allows us to
  1066. 55:35filter elements based on a condition.
  1067. 55:38For example, imagine we have a
  1068. 55:40two-dimensional array A that looks like
  1069. 55:42this. If we want to select elements that
  1070. 55:45are divisible by three, we can apply the
  1071. 55:48condition a percent 3 equals to zero.
  1072. 55:51This condition creates a boolean array
  1073. 55:54where each element is true if it meets
  1074. 55:56the condition and false otherwise.
  1075. 55:59By using this boolean array to index a,
  1076. 56:03numpy will return a one-dimensional
  1077. 56:05array containing only the elements that
  1078. 56:07satisfy the condition. This is helpful
  1079. 56:10when you want to filter the elements
  1080. 56:12that fulfill a certain condition from a
  1081. 56:14large data set.
  1082. 56:19Let's look at an example of this using
  1083. 56:21the notebook. Go to section 2.5.3.
  1084. 56:26In the Noah data set, there are certain
  1085. 56:28rows where PRCP is equal to 9,999,
  1086. 56:34which represents data that was not
  1087. 56:36recorded correctly. We can find out by
  1088. 56:38creating a boolean array X= to 999.9.
  1089. 56:47We can also use Boolean indexing to
  1090. 56:50extract only specific axes.
  1091. 56:55You can also apply boolean indexing
  1092. 56:57along only a certain axis or use it for
  1093. 57:00other functions such as ex function.
  1094. 57:06Let's take a moment to recap what we've
  1095. 57:08learned about numpy this week. Numpy is
  1096. 57:11an essential library for performing data
  1097. 57:13manipulation efficiently in Python. We
  1098. 57:16started by learning how to create an ND
  1099. 57:19array using the np.array function.
  1100. 57:23We then explored how NPI's functions are
  1101. 57:25universal, letting us perform
  1102. 57:28elementwise calculations without the
  1103. 57:30need for loops. Broadcasting was another
  1104. 57:33key topic, enabling us to operate on
  1105. 57:35arrays of different sizes by
  1106. 57:37automatically adjusting their shapes to
  1107. 57:40match. Understanding indexing and the
  1108. 57:43concept of axes in n-dimensional arrays
  1109. 57:45was crucial as it helped us extract
  1110. 57:48specific elements or subarrays with
  1111. 57:50ease.
  1112. 57:52Aggregation functions are perfect for
  1113. 57:54calculating statistics along each axis
  1114. 57:57of our data. Whether it's finding the
  1115. 57:59maximum value, calculating the sum, or
  1116. 58:03determining the average, these functions
  1117. 58:05help us summarize and interpret our data
  1118. 58:08effectively.
  1119. 58:10That concludes today's lecture.
  1120. 58:16>> All right, everyone.
  1121. 58:20So again I think it might be a lot of
  1122. 58:24information for
  1123. 58:27I think most of you if you are not you
  1124. 58:31have not any bit of science or
  1125. 58:33mathematics background but [sighs] yeah
  1126. 58:36again you just um don't worry about it
  1127. 58:41just keep um revising and practicing
  1128. 58:44that would really help and
  1129. 58:49for Now I there were actually two more
  1130. 58:54practice questions but
  1131. 58:56only have about 15
  1132. 59:00Oops that's not I want to show um have
  1133. 59:0515 minutes left. So, and I've seen that
  1134. 59:11quite some of you are
  1135. 59:19thinking like curious that how you can
  1136. 59:22use these numpy
  1137. 59:27into actual
  1138. 59:32um like a data science skills and what
  1139. 59:35what I can do with the Python and
  1140. 59:40all that type of question. And I really
  1141. 59:44think
  1142. 59:46that
  1143. 59:48um for example, if we look at this
  1144. 59:51question, it in this question is asking
  1145. 59:54me to standardize
  1146. 59:58um
  1147. 59:59the data in here. and
  1148. 1:00:05what what why why um the thing is um
  1149. 1:00:11standardize um these
  1150. 1:00:15data helps in terms of machine learning
  1151. 1:00:20um
  1152. 1:00:21for example in these data we have
  1153. 1:00:24temperature maximum temperature minimum
  1154. 1:00:28temperature and also pre participation
  1155. 1:00:32um which is in like mill or degrees. And
  1156. 1:00:36they are the these value are really like
  1157. 1:00:40different and those the the value
  1158. 1:00:44difference
  1159. 1:00:46like high or low really um
  1160. 1:00:53effect um in the in terms of machine
  1161. 1:00:56learning. So that um standardize allow
  1162. 1:01:00you to make all the
  1163. 1:01:04scale or value to make it um really easy
  1164. 1:01:09to compare and yeah.
  1165. 1:01:14So yeah and actually in this case you
  1166. 1:01:18standardize um
  1167. 1:01:22this data um all the rows going to
  1168. 1:01:25become for example in the mean would
  1169. 1:01:27become zero and for the standard
  1170. 1:01:31deviation would become one. So it really
  1171. 1:01:35easy to
  1172. 1:01:37compare that and
  1173. 1:01:42we're talking about numpy and what numpy
  1174. 1:01:45does is
  1175. 1:01:47it helps to um calculate all all those
  1176. 1:01:51values and all those data really fastly
  1177. 1:01:55than um the python coding. So that is um
  1178. 1:02:01why we are learning um numpy today and
  1179. 1:02:05we're going to cover um about more
  1180. 1:02:09depths about data science and machine
  1181. 1:02:11learning skills um later sessions but
  1182. 1:02:16yeah it is just the beginning of these
  1183. 1:02:19those
  1184. 1:02:20um road maps. So yeah, I hope you stay
  1185. 1:02:28in tune and
  1186. 1:02:31I really recommend you to revise these
  1187. 1:02:35um and lectures.

About this transcript

This page contains the full transcript of GCI World 2026 September Session2 During Lecture by GCI World (Matsuo-Iwasawa Lab), generated from the public captions YouTube serves with the video. The transcript has 7,188 words across 1,187 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.