Today, what I would like to talk about is a little bit of Python's journey to data science. A lot of people today think of Python as a data science language, and it's not always been that way. I want to talk a little bit about how we've gotten to where we are right now, and then give a little bit of a sort of survey of where Python is now in the data science space. So any of you out there who are hoping to get started, kind of have a roadmap of where to start. First a little bit about me, my name is Jake, JakeVDP. You can find me on GitHub or Twitter or Stack Overflow or other places like that. And my path has been an interesting one. I started studying physics, which led me to studying astronomy, which led me to analyzing large data sets and getting into data science and Python, and eventually that led me into software engineering, because I realized the real core of data science is good software engineering. So currently, after all this stuff, I'm working now as a software engineer at Google, and it's been a really interesting experience. If you're curious about that, I can chat with you afterwards. In the Python world, I've done a lot of things. I've been working on a lot of different open source projects over the years, including SciPy, Altair, Scikit-learn, AstroPy, and I have a couple books that some of you might have seen before, the Python data science handbook, and if you're into kind of like real sort of astrophysical data analysis, you can check out this. We have this graduate text in astronomy, data processing, so lots of fun stuff. So I want to start out by saying, as I mentioned, Python has come a long way to where it is now as a data science language, and as the way it started out, Python was not designed to be a data science language, and you see kind of vestiges of this sometimes when you approach Python asking data science questions. So for example, if you say, I want to visualize some data, and you go out in the world and ask various tools how to do that, if you ask someone from the R community, they'll say, you visualize data with GGplot, right? Has anybody used R and GGplot? A few people out there, it's a phenomenal tool, a phenomenal tool for data analysis, data visualization, data science. By comparison, if you ask Python how to visualize some data, you say this says, okay, you should use Matplotlib. Oh, you know, unless you want to do some interactive data, then it's Altair, or you can use Plotlib, or you can use Seaborn's Good for data science, and you can use Bokeh for other visualization stuff, and, oh, Hall of Views is this new thing, you know, there's all these different answers to the same question, how do you visualize data, and all these different packages and approaches people have developed, and this is sometimes a little bit infuriating, especially if you look at this thing, the Zen of Python. Has anyone ever typed import this in a Python interpreter? You get this nice Zen of Python. All these sort of rules that you can meditate about to make your Python as effective as possible, and one of them is there should be one and preferably only one obvious way to do things, and in the data science world, this is just not the case, right? I show the visualization here, but also storing data. You can use NumPy, or Pandas, or X array, or TensorFlow arrays, or PyTorch, there's all these different ways to do things, and it's a little bit of infuriating when you're getting started. You say, you know, why is Python this way? And what it comes down to, why can't there just be one way? It comes down to the fact that Python didn't start as a data science tool, it wasn't designed as a data science tool, or even a numerical or statistical computing tool at all. You know, if you rewind the clock almost 30 years and go back to the beginning, actually, we're getting close to 40 years now, huh? You go back to the beginning of Python. This is Guido van Rossum, and he created Python basically as a teaching language, and also to bridge the gap between the shell and sea. And you look at what Python was in the early years, and it basically was designed to be kind of an alternative to bash coding. It was like a friendlier way to stitch together the different things you were doing in your computer. And Guido gave an interview a while ago where he talked about his expectations in developing Python.  And you compare that to where we are today, where the top companies around the world have millions of lines of Python driving their products, in everything from data analysis to finance to fields in between. So how did we go from that almost 40 years ago, thinking Python scripts were going to be a dozen lines at the most, to where we are today, where Python is this data science powerhouse, where 1,600 people gather in Chennai, India, to talk about how they're using Python in their work. It's an amazing story. And I sort of like to trace this back through a few different decades and kind of organizing it into a few arrows. And I'm going to pick on Dave Beasley right now. He's one of the later keynote speakers. But I thought I'd stick his picture up here right now. So in the 90s, I think of Python in the 90s as like being in the scripting era. And Python was sort of this alternative to Bash. People wanted to write Bash programs to stitch together different workflows they were using. And Python was just a nicer program to use. And if you read what Dave wrote back 19 years ago in this paper and scientific computing with Python, he said, scientists work with a wide variety of systems ranging from simulation codes to data analysis packages to databases and visualization tools and homegrown software, each of which presents the user with a different set of interfaces and file formats. As a result, a scientist may spend considerable amounts of time simply trying to get all these components to work together in some manner. And Dave and others during that time really pushed Python as a solution to do this kind of gluing of different processes together. And some interesting code from that time is an example is the simplified wrapper and interface generator, Swig. And basically what Swig did was it gave you this really nice interface to kind of take your C code or your other compiled code and generate Python interfaces so you could use them more interactively and more intuitively. And this really helped pave the way for all the sorts of things that came later and all the tools that you use today. So that was a scripting era in the 90s. Python is an alternative to Bash. In the 2000s, I like to think about that as the SciPy era. So if the SciPy era had a motto, it would be Python is an alternative to MATLAB. MATLAB is this powerful system that a lot of scientists and engineers have used and still use to do data analysis, data visualization and things like this. And in the early 2000s, a lot of people were pretty jazzed about Python as a tool for gluing together their data analysis workflows and said, hey, you know, why can't we use Python for the kind of things that we're using MATLAB for right now? And one person who was instrumental in this is John Hunter. In 2012, shortly before he passed away, he gave a keynote at SciPy where he talked about the history of the Matplotlib project, which is the project that he created. And he said, basically, before Matplotlib, he had a hodgepodge of work processes. He would have Perl scripts called C++ routines. It would dump data files. He'd load them in the MATLAB. And after a while, he got tired of MATLAB and he started using NuPlot instead. And he looked at this and said, you know, I want Python tools that can take all these different pieces of my workflow and put them into one package. Similarly, Travis Oliphant, who created, co-created NumPy and SciPy with some others in the community, he said, prior to Python, I used Perl for a year, then MATLAB and Shell Scripts and Fortran, C++ libraries. And when I discovered Python, I really liked the language. But it was very nation and lacked lots of libraries. And I felt like I could add value to the world by connecting these low-level libraries together to high-level usage in Python. So, again, the same story. He had all these different tools he was working with and he wanted Python to glue them together and to be this kind of one workhorse that could do all these numerical things. Similarly, Fernando Perez, who you might know as the creator of the iPython and Jupyter projects. He was a quantum physicist at the time. And he said, he remember looking at his desk, seeing all the books of languages, stacked with books on C, C++, Unix Utilities, Perl, IDL, Mathematica, Make. And I realized I was probably spending more time switching between languages than getting anything done. And this is what drove him to create the iPython project and to start using Python to stitch these workflows together. So if you look at the software that came out of these three folks and all the folks around them that were working on the same things, these big software packages are Matplotlib around 2002, SciPy around 2000. I wrapped NumPy into SciPy there. And iPython around 2001. And I dug through the internet to find these original logos for each of these packages. They're pretty awesome. I love the red on yellow of Matplotlib. It's a really, really good design choice. But as time went on, actually, originally each of these packages had some components that overlapped. They all had some component of visualization, some computational tools, some shell tools. And eventually, as these folks started talking to each other, they realized that they had some overlap and decided to start working together. And so that brought us to our modern situation, where we have Matplotlib, SciPy, iPython, which have distinct use cases within the scientific analysis stack. And they're all built on NumPy, which is this unified array library that goes underneath them all. So this is kind of like 2000 to 2010. This sort of stuff kind of percolated out. And we ended up with a really nice stack where we could do in Python the kinds of things that scientists and engineers had been doing in Matlab and are still doing in Matlab. So that's the SciPy era. And if you look at the key conference series, the SciPy conferences were big in that, starting as sort of meetups for the people developing these tools to now where they are the core meetups for the users of the scientific stack in Python. OK, so we had the scripting era. That's kind of Python as an alternative to Bash. We have the SciPy era. Python as an alternative to Matlab. And where are we in the last 10 years? I like to think of the last 10 years as the PyData era. And if PyData has a motto, it would be Python as an alternative to R. R has really developed as a powerhouse of a tool for statistical analysis in particular, and for cleaning and analyzing and interpreting and visualizing data in particular. And a lot of folks in the Python world wanted a Python alternative to R. They really appreciated the beauty of Python and its syntax and didn't want to have to switch languages when they were doing this kind of data analysis. So I think what kind of kicked off the PyData era in a lot of ways was Wes McKinney and his work on the Pandas package. And Pandas is interesting. Wes was working at the time as a consultant in the financial sector, where a lot of people were using R and other tools of that flavor to do data analysis. And Wes was, again, one of these people who wanted to use Python. He loved the Python language and wanted to be able to use Python for those kinds of applications. So if you read in the intro of his book, Python for Data Analysis, he has a really nice discussion of what led him to develop Pandas as a library for Python. And he said, I had a distinct set of requirements that were not well-addressed by any single tool at my disposal. Data structures with labeled axes, integrated time series functionality, arithmetic operations and reductions, flexible handling of missing data, merge and relational operations. And I wanted to do all these things in one place, preferably in a language well-suited to general-purpose software development. So again, you see this theme coming through. It's people who have workflows that involve multiple tools and saying, Python is the tool I want to use for this. And figuring out how can I bring these workflows into Python in a way that will help me and help others. And so Wes created the Pandas package. Other key software development, kind of in the early 2010s, where Scikit-learn, which is a machine learning library that a lot of you are familiar with, Konda is this package manager that came around and solved a lot of the difficulties with packaging scientific software. The IPython notebook and later the Jupyter project provide a nice compute environment for working on analyses and sharing them with your coworkers and colleagues. And there was this key conference series, the Pi Data Conference, which has expanded to this international set of workshops and meetings. And it's been really interesting to see it grow. The Pi Data Conference is very kind of close to my heart because it was my first Python meeting. The first talk I gave at a Python meeting was at the first Pi Data Workshop in March of 2012. I'd never been to a Python conference before that and because I'd been working on the Scikit-learn project, they asked me to come talk about machine learning in Python and it was the wildest thing.  And it was so interesting to meet them and to get into that. And I've been enjoying the Python community ever since then. So anyway, we have these three kind of eras of the Python language that were Python developed from this kind of alternative debash where you could write dozen line scripts all the way into now where you can use Python as the full stack for scientific or scientific data analysis and related things. So if there's any theme that I want you to take from this survey, it's that, you know, people want to use Python because they think it's an intuitive, beautiful language. And people look to the tasks that they have to do and figure out how they can use Python for it. And that's why we're here today. It's because of all these individuals who decided they wanted to use Python, wanted to make the ecosystem better. And so Python has incorporated all these lessons learned in other tools and communities and it's what makes Python the powerhouse that it is today. So it's important then to recognize with this perspective that Python's not a data science language, right? But because of all these commitments over the years and all these contributions from people, it's become this general purpose language that can do data science well. So one way I like to think about Python is it's sort of a Swiss army knife, right? You have this one package with lots of different tools in it. But it's different than a normal Swiss army knife because it's a Swiss army knife that anybody can contribute to, right? And so you have lots and lots of different opportunities of different tools that you can use that are written in Python. But the strength of that is you have a huge capability but the weakness is like it's hard to know where to start, right? There's no top-down governing body saying that this is the new package that you should use for visualization. You have a half dozen people trying to solve their own visualization problems and putting tools out there for you to use. And it's really hard to know where to start when you want to do something in Python if you've never started with it. So the second half of the talk now with this framework of where we've come from, what I wanna talk about now is where we are right now. If you're someone who is looking at Python as a potential tool for data analysis or for your own work, where should you start? And I wanna give you a little bit of a roadmap of the types of tools that are out there and what you should look at as you look into this. So first, you need to start by installing Python and installing various packages that you can use in it. And I would recommend this conda installer. Python packaging has come a long way in the last 10 years, but conda was a real turning point in my experience where prior to 2012, I remember struggling for hours and hours to try to get tools like NumPy and SciPy to install on my system. And I was using Linux where it was easy. If you're using Windows, then forget about it. Has anyone ever tried compiling SciPy on Windows? It's an experience I would not wish on my worst enemy. But fortunately, the conda team basically solved this in one swoop where they created this package manager called conda and it basically comes in two flavors. You have the mini conda, which is basically the smallest thing you need to get started. It's Python plus the conda installer and you can start installing the packages you need. Or if you don't want to have to make decisions, you can install anaconda, which is basically mini conda plus the entire universe of useful Python packages. So you install that, it's a few gigabytes and you're just ready to go. I usually start with mini conda because it's more lightweight and you can build up what you need. And if you go to the conda website, you can see there's Windows, Mac and Linux versions, 64-bit and 32-bit, Python 2, Python 3. You can choose where you want to start. I'd say choose the Python 3 at this point.  And then you have this two things installed. You have the conda tool, which helps you install packages. You have Python itself, which lets you run Python code. And these are both executables that are installed by conda. And now if you want to start installing packages, you say conda install numpy scipy pandas mapout libjupiter and it will install them on your computer. It'll install pre-compiled binaries, whether you're on Linux or Mac or Windows. And it's just slick and it works. So start with conda and install those packages. You can also do more fancy things like create environments, like you can have a Python 2.7 environment next to your Python 3.7 environment with separate packages. It really makes the whole thing nice. So when you activate this new environment, then you have different Python versions and you can actually run the Python command and you're getting your new Python binary there. So anyway, if you look at my computer and you list all the environments, I tend to use conda to basically separate all the different projects that I'm doing. I have conda environments for all the major Python versions and then for the various tools that I'm working on, I have development environments for say, AstroPy or SciPy or Scikit-learn or Vega. And keeping these things separate means that when I say when I try something new in SciPy, I don't break the environment that I need to use to start analyzing my data for my other projects. So it's nice to sort of keep things separate. Conda is a good tool for this. And just as a little side note, there's also this tool called pip, which is for installing Python packages. And if you're curious about the difference between conda and pip, it just briefly, pip is something that installs Python packages in any environment. And conda is something that installs any package in a conda environment, right? So conda is a little more broad in that it can install things like Fortran tools that underlie your libraries. But pip is specific to Python, but it can kind of work anywhere. So anyway, that's package managers for getting started with Python. Once you have your packages installed, you need an environment to start coding in. And I often recommend people start with Jupyter or JupyterLab. So JupyterLab is basically, you can think about it as a front end in which you can develop your code, execute your code and share it.  And what Jupyter does is it gives you a browser-based interface where you can start executing Python code. So you open a new notebook, and you have this Jupyter notebook right here. You start entering code, and the cool thing about JupyterLab is that the outputs of the code are embedded right there in the notebook, including visualizations. You don't have a separate window popping up, and you can kind of keep all your code, all your data, all your outputs in one place. And JupyterLab is a really interesting and dynamic thing. It's built on the Jupyter notebook, which has been around for about seven years now, in one form or another. But JupyterLab itself is a more full-featured IDE, a full-featured interactive development environment where you can edit text files, you can edit notebooks, you can view images, you can view various file types. And it gives you a really flexible way to start exploring the Python ecosystem. So that's the coding environment. And something that's based on the Jupyter system and built on top of that, which is really interesting, is this project called Binder. And you can think of Binder as a way to take your Jupyter Notebooks and your JupyterLab projects that are stored on a place like GitHub, and open them, and view them live without having to do anything on your own computer. It's a way of kind of like turning your Git repo into something that you or the users or your collaborators can execute and work with interactively. So for example, my Python Data Science Handbook, I have this Launch Binder button. And all the content of the book is on GitHub in the form of Jupyter Notebooks. And with Binder, what this means is you can launch it and you have the interactive Notebooks there to start executing code and exploring the code and modifying things and seeing what you can do without having to run anything on your own computer. So it's a really cool system that's been developed by the Jupyter folks. I should also mention a similar, in some ways, similar thing is this project called Google Colab. This has been the project that I've worked on at Google in the last year. And it's basically a Jupyter Notebook on top of Google's computing infrastructure and backed by Google Drive. So if you use Google Docs to store your files, Colab is basically a way to store your Jupyter Notebooks on Google Drive and to execute them in the cloud, all for free. And a nice thing about it is it's zero setup. You can share with people and you have free access to hardware like GPUs and TPUs that let you do powerful computing without having to invest in your own computer and the amount of money and time it takes to get something like that set up locally. So from there, we have our computing environment.  The real powerhouse behind most of Python's machine learning and data analysis packages is this package called NumPy. NumPy stands for numerical Python. You can conda install NumPy. And essentially the core of what NumPy is is an nd array object. It's basically a very flexible container for your data. And you can define your data and you can start doing arithmetic operations on your data. Like here, we're taking the contents of this x array, multiplying it by two and adding one and we get the array out, this element or y is arithmetic. And notice that the loops and the handling of memory and things like that here are implicit. So with NumPy, you can do a lot of different numerical computation. For example, linear algebra is built in. If you wanna do something like a singular value decomposition, this is a fundamental operation that underlies a lot of machine learning algorithms. You can do that in one line in NumPy. And if you look into more high level tools like scikit-learn, scikit-learn is using NumPy's linear algebra tools under the hood to provide you an API to do machine learning in a very convenient manner. You can do other things like fast Fourier transforms and a lot of the core routines that underlie data analysis. So the key to using NumPy effectively if you start digging into this is something known as vectorization. So if you come from a language like C or Java or Fortran, you might be used to doing these kinds of things by hand. You know, you have an array of data and you say, I want to operate on each value in this array. You might be tempted to write a for loop where you take a define an array for the result. You loop through each value. You assign the, you operate on each value and assign it to the output. But if you time this in Python, this for what is this, 10 million values, takes about six seconds, which is really phenomenally slow in the age of modern CPUs, right? Python, when you start looping over data and doing repeated operations, Python is really, really slow. But when you use tools like NumPy, you get, by using this vectorized approach, not only do you avoid the need to write these for loops explicitly, but you get a hundred X speed up just by writing more intuitive code. That's because what NumPy is doing is it's taking these operations and pushing them from the slow Python layer down into the compiled C layer under the hood. So if you wanna know more about this, I have a talk from PyCon 2015, and there's also a lot of other interesting resources online to learn more about vectorization and using NumPy effectively. So NumPy is good for kind of raw data sets, but in the real world, data has labels, right? You have, and often you don't wanna access your data by index, you wanna access your data by the labels of the columns. And this is where Pandas comes in. Pandas, the name comes from panel data, and it's basically an answer to R's data frame within the Python world. And what Pandas gives you is kind of a wrapper around NumPy's functionality that lets you access sections of your data by name rather than by index. So you create a data frame with a column named X and a column named Y, and you can start manipulating these pieces of data by name. So create a new column that's called X plus two Y and just do what comes natural and do the column plus two times the other column, and it creates the data frame for you. Pandas' other real strength is reading serialized data files like CSV. NumPy has some tools for this, but they're not nearly as mature or user-friendly as the Pandas versions. So you can read data in one line from a CSV file or a JSON file or a database or any other data source. And then once you have the data, you can start doing fast SQL-like grouping and aggregation and the other types of algorithms that really go into more complicated data analysis. So we can group by the ID and take the sum, and we see here that I gotta make my tools go away. The sum of all the A values is four and the sum of all the B values is six. This might seem small, but having this kind of functionality in a very efficient manner is huge, and there's not really any easy way to do this in NumPy by itself. Okay, so you have your data analysis, NumPy and Pandas, and now you wanna visualize it. Matplotlib is this core visualization tool that's been used for almost 20 years now. And to give you an idea of how pervasive Matplotlib is, in my PhD work in astronomy, basically every research paper I ever published had all Matplotlib plots. I never used any other visualization tool to create plots in my papers. So Matplotlib is really powerful and lets you do a lot of amazing things. You can create pretty much any figure in any visualization with Matplotlib. So what it looks like is this, is you have a plot function and you pass in two arrays and it gives you the output. So here's plotting a sine and a cosine. But these days there's a lot of things that people want to do that Matplotlib can't do, and the biggest example of that is interactive visualization on the web. So if you click on a website and you see an interactive chart where you're clicking and zooming and scrolling, Matplotlib can't really do that. So there's been a number of packages that have come along that have tried to address this need. Oh, before I get into the interactive packages, the other thing that Matplotlib doesn't do very well is handle named data like in Pandas. So Pandas itself actually has a wrapper on Matplotlib that lets you plot data by name rather than by index. So if we take a data frame and we do plot dot scatter and say we want to scatter the petal length versus the petal width, we get that scatter plot. And similarly, the seaborne package has this pair plot function and other functionality that lets you do more specialized plotting in a few lines of code. Another package that's really interesting that builds on Matplotlib is this one called plot nine. And if you're used to R's GG plot, plot nine is a really nice answer to that. It basically gives you the GG plot API within Python and outputs Matplotlib plots. So you can do things like define the aesthetic, define the geometry, whoops, define the statistics and the kinds of facet you want. And if you're an R user, this should look really familiar. You get this sort of grammatical approach to plotting but you get it with Matplotlib. So yeah, a lot of tools built on Matplotlib and then going into this more like web interactive visualization stuff. There's a tool called Bokeh and Bokeh's strengths are that it's really good at analyzing large data sets in an interactive in browser manner. You can do lots of different things. So again, you can check this out. Another tool, there's a company, a startup called Plotly that has a tool called Plotly that is similar in spirit. It lets you do a lot of interesting kind of interactive and dynamic visualization from Python. And one thing that Plotly does really well is it has tools for animations. So if you want to create animations within your browser in Python, Plotly is a good tool for you. And then a tool that I've been working on this has been my project, my open source project for the last couple of years is called Altair. And basically this is what we wanted to do with Altair is provide a grammar based approach to plotting similar in spirit to Gigiplot but based on a somewhat different grammar of graphics that lets you kind of more intuitively define complicated interactive visualizations from Python. And Altair lets you do a lot of interesting things like linking plots across each other. So you interact with one plot and it updates the other plots and things like this and all of this in a very compact, sensical API. So if you're interested in that, I have some talks online that you can look at or you can look at the Altair tutorial or other Altair resources online. I'm happy to chat about that a little bit with you afterwards. So if you want to kind of make sense of it all and you don't know where to start in the visualization world, there's this cool website called Pyves which is essentially an effort to organize this information about visualization. And okay, so some interesting things that have happened recently in this space are something for dashboarding. There's this project called Panel that's come out recently and what this lets you do is use Python to quickly define interactive dashboards with callbacks to the Python kernel that you can even post on websites and let kind of users see without having to without having them having to run the code themselves. So this is an example, if you take an Altair chart, and this is a simple, basically a function that makes a chart given a stock symbol. So we get the stock data and we choose that symbol from there and we chart, mark line and encode the date versus the price. And so if we plot Apple here from this data, we see Apple's stock chart there. And what Panel lets you do is it lets you take this function, this make chart function and pass it to a method that creates an interactive version of it and then embeds that in an output display. And it gives you a little widget that lets you choose the input value, lets the user choose the input value and then have the result be reflected right there. And the key to this is that this function, this make chart function can do anything. This could run a machine learning model or fit some sort of sophisticated process to your data. And if you look at the Panel website, they have examples of this where this is live on the internet. You click on the example and you get a version of this that you can just look at. And it's a dozen lines of Python code and it makes creating kind of interactive browser-based explorations of data a very intuitive and easy thing to do. So it's a cool project and like I say, this is relatively new. I've just heard about this in the last maybe six months. And it's out from the same people who created Anaconda and Bokeh and some of those other projects. So check it out, take a look at that. It's fun to look at. Okay, so we have our computing platform in Jupiter. We have our numerical data analysis libraries. Whatever visualization. What if you wanna go a little bit beyond that and start doing some more sophisticated analysis? So SciPy is the tool that you want for that. And this has been, like I mentioned, this has been used for about the past 20 years as a tool for doing scientific analysis in Python. And it has a whole host of interesting functionality. You know, a lot of the, when I was doing, when I was developing new algorithms to analyze astrophysical data, a lot of the approaches that I used were straight out of SciPy because it has things for sparse matrix, interpolation of data, numerical integration, spatial metrics, statistical functions, optimization, linear algebra, mathematical functions.  So anything you wanna do in Python, you can basically do with SciPy. And an example of this, here's a few lines of code where we create a, we create an X grid. We minimize the first order Bessel function over that X. We plot the result and we plot the minimum point in that result right here. So this red point right here is the minimum that we found based on this optimize.minimize. So a few lines of code and you're able to do these things that if you're used to being an old school scientific coder doing this by hand, this would be a lot of lines of Fortran that you can do it in just a few lines of Python. And that's really the power of Python for data analysis. If you wanna go a little bit beyond that and do machine learning, you can use this package called Scikit Learn. And essentially what Scikit Learn does is it takes NumPy and SciPy and all the tools, the lower level tools available in there and gives you a high level API for machine learning. So here's an example. If we create an array of random X points, we compute a function, y is sine X plus some noise. We plot it, we get some data that looks like this. Now how might you find, kind of smooth this data and find the line of best fit in there? With Scikit Learn, it's a few lines of code. We can use basic, we can use something like a random forest regressor. This is just one example of a machine learning algorithm that's available. And once you have your model that you create, you can fit it to your data. So we're gonna fit it to our X data and our Y data. This little colon new access thing is just to basically take the data from a row array and turn it into a column array. And then we can compute the grid on which we wanna fit it. And then we predict on this grid and figure out what the Y values are and we plot the results, plot the data and plot the fit on top of it. So this is what a simple random forest model gives for this data set. And the power of Scikit Learn is that the API is regular enough that if you wanna use a different model, like a support vector machine regressor, you just drop in a different model and look, the rest of the code stays exactly the same. It's just the Python class we use that defines which model you're gonna use. And you can see that the support vector machine has different characteristics. It doesn't conform as closely to the individual data points. It does a little more kind of smoothing. And as you dig in and learn more about these machine learning models, you can get an intuition for which one is better depending on what you wanna do with your data and your model. So Scikit Learn's a really cool package for that. And this is something that, the Scikit Learn was sort of the way that I got into the Python open source world as I started contributing to this package about 10 years ago, 2009. And it's been a cool thing to be involved with. So we have all this numerical analysis, SciPy, Scikit Learn. We're starting to build up a really interesting tool set. What if you wanna start moving to larger data sets? There's this great tool called Dask that a number of people, I've already talked to a few people today who are using this in their own work. What Dask does is it basically provides a Python API around massively parallel execution of code. And the cool thing about this API is that it lets you do things without having to worry about the details yourself. So a typical data manipulation with NumPy. We have an array, we multiply it by four, we take the minimum and we print the result, something like that. The same thing in Dask is basically the same code except we import Dask array and we create our array, we multiply it by four, we take the minimum and we print the result. And in this case though, the result is not a number. This result is an abstract representation of the calculations that you just did. And there are ways to visualize what this representation is. And basically you're taking your array, you're splitting it into five chunks, you're creating arrays for both of those, you're multiplying each chunk by four, then you're taking the minimum of that chunk and then you're combining all these chunks together, taking the minimum of each and you get the minimum value. So that way, instead of doing all these multiplications and minimums on one process in one core, you're splitting it among multiple processes. So this is a little silly for multiplying an array by four and taking the minimum but you can imagine how this generalizes to more sophisticated operations. And what it means is that you can call compute on this task graph and get the result. And the power of this approach is of this task graph, this abstract representation of what you're trying to do with your data can be sent out to an AWS cluster. It can be sent to a GPU on your machine. It can be sent to a condor cluster of all the desktop machines in your academic department if you have something like that. It's a really flexible way to describe the problems you're doing and to evaluate them. So another sort of code optimization thing that you might have come across in the Python world is Numba. This is a really cool package and basically what it does is it tries to take Python code and compile it down into fast LLVM code without much extra work. So a typical example, everyone likes their Fibonacci numbers. So here's a Fibonacci number calculator in Python. And to compute the 10,000th Fibonacci number using this sort of loop-based approach is two milliseconds per loop. So you might think that's sort of fast, but it's sort of slow. If you do the equivalent in a compiled language like Fortran or C, it's gonna be a lot faster. What Numba lets you do is add a decorator to this function. Okay, I haven't changed anything except for adding this decorator. And you get a 500X speedup in these sort of loop-based approaches to analyzing or to working with data. What this is actually doing is it's taking the bytecode in this defined function, compiling it to LLVM, which is sort of like a compiled fast language, compiling it to LLVM, compiling that and then executing the compiled code rather than the Python code and dropping in the result for you. So there's been some really interesting things done with Numba to kind of speed up more sophisticated analysis and particularly in image manipulation and things like this. So check that out if you're interested in like how to make your Python code faster. So another one I should mention real quickly is is a Scython. So Scython is sort of a way to marry C and Python. And similarly, if you take this Fibonacci number generator, what Scython does is it allows you to compile your Python code into C rather than LLVM. And for example, if you just run this basic Python code through the Scython interpreter, you get a 10% speedup, you know, it's not that much. But where you can really start taking advantage of things in Scython is if you kind of combine the idioms of Python and C into one script and you start defining typed variables inside your Scython code, then you get the same 500X speedup as Numba just by kind of like compiling into optimized code. And I often say that Scython is my favorite language to program in because it's like, it's got all the beauty of Python and all the expressibility of C. And so I really enjoy writing code in Scython because it lets you do some interesting things. And Scython is really a powerhouse behind all the tools that you're using in the Python data science world. Your NumPy, SciPyPand as Scikit-learn, AstroPy, SimPyPand, and a lot more are using Python at their core to make the tools you use fast. So there's so much more out there that I haven't talked about. I just wanted to basically give you a brief survey of the core tools that if you're jumping into Python data science that you should get familiar with. If you look at all the tools that have been built on top of these, there's a ton from all different domains and all different fields, whether you're working in neuroimaging or astronomy or biology or anywhere in between. People are out there writing Python code and making Python tools to do the kind of workflows that they have. And so as I finish this, I wanna remind you that you should not think of Python as a data science language because that's not what it was created to be. It was created to be a language that's easy to use, a language that's expressible and a language that's beautiful and fun to code in. And this is probably its greatest strength, right? Because Python is such a great language to use, people invest time into making it work for their own use cases.  And this is kind of what I wanna leave you with. You know, the 90s, I talked about Python being the scripting era. 2000s was the sci-fi era. 2010s is the pie data era. We're coming into another decade. And where Python goes from here is up to the people who use it, up to the people who build these tools that other people are using. So you know, it's up to you. Any of you can kind of decide and influence where Python goes as we move forward in this next decade. And I, for one, I'm interested to see where, what comes out and where it all goes. So thanks very much. Here's my information. And I'd love to take some questions. So you talked about the next generation, right? Like from, so what do you think where Python will be? Is it HPC? High performance computing or making Python more faster? Yeah, I don't know. It's hard to say where Python will be in 10 years. I mean, I don't know, I don't know if anyone would have predicted 10 years ago where we are now with Python being the kind of the core algorithm, core tool for deep learning and things like that. What I really hope, I really hope is that Python can become more of a tool for the web. You know, JavaScript is taking over because it's, because everybody, everybody has a JavaScript interpreter on their phone or in their computer or on their watch even. And I'd love for Python to kind of make headway into the world of the web and the browser. So I don't know if I'm predicting that'll happen, but I hope that happens. Still, we see Python in the field of web development generally, but we have Fortran from last 20 years, but we don't see Python there in HPC. Okay, next question here. I didn't catch that, I'm sorry. Hello, next question over here. Okay, yeah. Hello, yeah. Thanks a lot for your talk, Jake. It was really nice knowing the roadmap and how can we proceed. So I am intrigued by the tool, particularly that you work on, is that all data that you are talking about. And from what I understood, it's a kind of visualization tool. So my question to you is, well, while you are working on it and designing on it, are we also looking at from the universal design principle? For example, me being a visually impaired person I cannot access these graphs by just looking at the screen. So are we also trying to build that functionality in these applications and things? We have some insight into this as well in our talk at around 11, but I would like to know your views on that. Yeah, thank you for that question. That's a really good point that we need to figure out how to build sort of broad accessibility into our tools and into our analysis. One thing I will say with the Altair project that I'm working on, we've thought a bit about that. And one of the strengths there is that any plot generated with the Altair project also has kind of a full description of the plot and all the data embedded with it. So there's some work on the VegaLite library which underlies it to add more accessibility tools onto the VegaLite chart display. And I'm excited about that because it means that the visualization is no longer just a grid of pixels on a screen, but it's the data set and a full description of the data set in a grammar of visualization that offers a lot of opportunities to make these more accessible. So it's a good reminder, though. Thanks for the question. Hi, Jake. It was a wonderful talk. I wanted to ask about Namba. So why can't we just always use Namba? What are the best practices to use Namba? And in what situations Namba won't be able to cause a major speed up? Yeah, I'd say for Namba and Scython both, the times that you want to use them is when you find yourself writing big loops in Python and looping over data. If there are things that you can't express in terms of NumPy vectorization primitives, then Namba and Scython are the way to go. So essentially like four loops in Python are slow and you need a way to speed them up. So I think this is going to be the last question. So last taker. Last question? Where is it? Okay. Yeah, so like you said, that Python kept evolving with data science. I'd actually like to ask a question about quantum computation, which I'm working on currently and how CERC and Qwiskit and everything's just coming onto that. How do you think Python's gonna evolve on those kind of future technologies? Yeah, quantum computation. That's a good question. Looking at the past and how we've gotten here, I imagine that Python will start, people will have kind of ways to call their quantum routines or more sophisticated routines and Python will start as glue to call those. Rather than writing a bash script, you'll write a Python script. And then maybe after a while, someone will come up with a higher level API that can wrap that. And maybe eventually you'll be writing your quantum computation scripts in Python with built on QuantPy or whatever package you end up writing for all of us to use. So thanks very much. I'm gonna be around for today and tomorrow and I'm happy to chat and answer any other questions you have. I appreciate your time. Thanks.


The term is tissue agnostic. What does tissue agnostic mutation or driver mean? That means that it does not matter. The way we always look at cancer is histopathology.  And that was important because for whatever reason, like an adenocarcinoma and the colon may not behave the same way as an adenocarcinoma lung. So it was very important for the tools we had, which was cytotoxic chemo. Now we're realizing, yo, it doesn't really matter what's on this slide as far as the histopathology goes. It's more because now we're at a molecular level. We're not looking at the conglomerate of cells, but inside to actually look at the pieces and all the switches, we can actually say, if we target it, it doesn't matter what it is, it can respond. If you have one or two mutations, then hopefully we will have developed a precision med that can go after the thing that's causing the cancer, block it, get a great outcome for the patient. If you have a lot of mutations, hey, immuno-oncology works well for you then.


Minister is the first Minister's Questions. At question no 1, Douglas Ross. That is what the Parliament's finance committee calls for updated costs of the SNP's controversial plans for a centralised special care service. Hamza uses Government have refused. The last estimate for the centralised care service was £1.3 billion. After that figure came out, Audit Scotland said this. It is likely that the overall cost of the measures will be significantly above the amounts currently assessed. Will the First Minister tell us now how much is this really going to cost Scottish taxpayers? First Minister, first and foremost, let's not forget why we have introduced the national care service legislation. It's to end that postcode lottery of care that we all accept exists right up and down the country. That inconsistency of care that has existed, we want to introduce a system that ensures that we put fair work principles at the very heart of the national care service, and that we put those who need care at the very heart of a national care service. Opposition, quite rightly, has asked for from the Scottish Government to ensure that we engage with local authorities and with our trade union colleagues. First Minister, just before we go any further, I would be grateful if members could treat one another with courtesy and respect. It's hardly a surprise, Presiding Officer, that they have grown when I mentioned fair work principles and working with trade union colleagues. What I would say to Douglas Ross is that he was one of the first to call for us to pause the national care service legislation so that we do engage with local government. We do engage with trade unions. We are doing that in order to hopefully find a level of compromise in the national care service legislation, which will allow us to take that forward with, hopefully, an element of consensus. Depending on what that compromise is, of course we will determine whether there are any changes to revise financial memorandum. Once we have had that engagement, intensively over the course of the summer, we will return to the Parliament and ensure that there is a revised financial memorandum. Douglas Ross The muted applause hasn't got any better from last week, and it's no wonder because the answers haven't got any better either. The First Minister has suggested there may be additional costs, or that Scotland were very clear. The £1.3 billion cost is not going to be the final cost, it's going to be higher. It turns out, from that feeble answer that didn't address the point, the First Minister has no idea what it's really going to cost. He is throwing public money away when front-line social care services are in desperate need of more funding. The SNP could be investing to improve the local services, instead they are creating a bureaucratic nightmare and want a blank check to do it. Already the SNP has wasted £14 million on this plan. They have spent £1.9 million on consultants, but the plans are not advancing, there are no signs of progress and the legislation has been repeatedly delayed. Is the First Minister paying consultants a fortune to tell him what everyone else knows, his plans are woeful and they won't work? It is hardly a surprise that a national care service plan that puts fair work at the heart of it, that puts sectoral bargaining at the heart of our plans for national care services, that puts ethical commissioning at the heart of our national care service, is wholly opposed by the Conservatives. It's hardly a surprise to anybody in this chamber, hardly a surprise to our trade union colleagues and hardly a surprise to the people of Scotland. All of that, why are we bringing it to national care service for? We're bringing it forward because we know of the extreme challenges that are faced by those working in social care because of workforce.  Of course, one of the fundamental reasons for that workforce challenge is the hard Brexit imposed upon us by a UK Government. Once again, the Scottish Government is having to pick up the pieces. Once again, the Scottish Government is having to mitigate the woeful decisions made by a cruel Tory Government. How are we doing that? Yes, we are committed to spending the national care service, but we have also made sure that there is an additional £100 million to provide that pay uplift from April of this year. That represents a 14.7 per cent increase for those workers in the past two years. I was proud when I was health secretary to make sure that there was not just one, not just two, but three pay uplift for our adult social care workers, and we want to go further where we can. We are committed to investing in social care right now to undo some of the damage done by the Conservatives' hard Brexit. At the same time, we are absolutely committed to our plans for a national care service that will ensure that fair work is at the very heart of any future care service. You would not have guessed it from that answer, but it was actually a question about spending almost £2 million on consultants on this proposal that the First Minister failed to address in his answer. However, those plans are such a mess that his social care minister, Marie Todd, who is sat in the chamber just now, said this week, that it has been a little bit hard for me to get my head around—a bit hard—for the minister in charge to get her head around. First Minister, she is talking about your plans, because before Hamza used to have failed upwards, he was not just the health secretary, he was Cabinet Secretary for Social Care. He wrote the shambolic plans. So what does it say about the First Minister's policy if his own care minister does not understand it? First Minister, it just goes to show how desperate Douglas Ross says when he starts with the personal attacks on me or any of my colleagues. Not on the policy, not on the substance, on the personal attacks from a man who is, of course, the least popular elected politician on these islands, by any poll estimation in the entire government. Oh, and the best tort that Douglas Ross has is that, as I am catching you up, you are still the most unpopular leader elected politician in this country by quite a country mile. Douglas Ross is on consultancy spend, because it is an important point, of course. The Scottish Government and our officials are absolutely focused on making the national care service work, but it is important that we bring in those additional technical and specialist expertise that allows the Scottish Government to ensure that we make progress on the legislation itself. In terms of the finances around the national care service, which is a very legitimate question, I have said that, of course, we will engage with trade unions, engage with local government, and hopefully, when we reach a compromised position on the national care service, we will come back with a revised financial memorandum, but I am hardly going to take and neither will any of the ministers in my Government take any lectures on financial literacy from Douglas Ross, who demanded that this Government copy Liz Truss's tax cuts, which would have cost the Scottish Government £500 million and caused economic pernage to our Scottish public finances. Douglas Ross is absolutely hopeless from the First Minister. He said that it was a desperate tactic by me to quote his own Minister. I am listening to that answer, and I'm pretty sure Marie Todd still can't get her head around the policy or the costings, because it's quite clear the First Minister can. This is all starting to look like another Humza Yousaf disaster. The man who couldn't get the trains to run on time, forced police officers to breaking point and left our NHS in crisis, is now doing his best to throw social care into chaos as well. He doesn't know if he's building a national care service or a white elephant. Humza Yousaf has no idea how much this centralised care service is going to cost, or when this bureaucratic nightmare will be ready, or how it will improve the situation for people who desperately need better care. The very last thing our struggling care service needs is our administrative overhaul, costing billions of pounds when it's being starved of cash from the front line. Will Humza Yousaf do the right thing? Stop wasting taxpayers' money and scrap those plans altogether? Quite incredible, Collin, officer, that when we have given a pay-up lift to adult social care workers, Douglas Ross describes that as a waste of money, because every penny we spend on social care is ensuring that we lift standards for adult social care workers, ensure that we're lifting standards for those who are in receipt of care. While we do that, yes, build a national care service that has fair work at its heart, build a national care service that has ethical commissioning at its heart, so that the profits from care aren't just gleamed away into bank accounts in the Cayman Islands—something, of course, that the Conservatives would like to see—a national care service that makes sure that we put sectoral bargaining at its very heart. That's what we're committed to. All of that, of course, is in the midst of the fact that we've had over a decade of austerity from Douglas Ross's Conservative. We've had a hard Brexit imposed upon us and, of course, the disaster of the mini-budget, which, if we had listened to Douglas Ross and gone ahead with tax cuts for the wealthiest, our budget would be worth £500 million less. I'll take no lectures about financial literacy, nor, indeed, for standing up for those who are working at our care service from Douglas Ross or the Conservatives. It's just been announced that interest rates will go up again, meaning higher mortgages, all because of Tory economic chaos. That's in the same week that the SNP launched its campaign for another Tory Government. So can I ask the First Minister to put aside his party's self-interest and be honest? What is better for Scotland? A Labour Government or a Tory Government? What's better for Scotland is independence, of course, because everyone will have the colours in our own hands. Of course, it is exceptionally brave for Anasawa to go on this topic of this week of all weeks, because what we have with Keir Starmer's Labour Party is somebody who has refused to reverse every single measure of Tory austerity. What we have with Keir Starmer is, of course, an individual who has been rigged on his promise to abolish tuition fees for students in England. What we have with Keir Starmer just yesterday is an individual who refused to repeal cruel Tory legislation such as the illegal migration bill. Scotland does not need cruel, harmful policies imposed on it, whether it is by a politician that wears a blue tie or a politician that wears a red tie. What Scotland needs is the full powers of an independent nation to chart our own course and get out of this unequal and broken union. Do you have it? Thank you. We have visitors who have gathered to hear the questions and answers. We have people tuned in across the nation who are also keen to do so, and I would be grateful, while I appreciate your passion and interest, that we try and behave ourselves with decorum. I think that you should be softer with them, Presiding Officer. It's the first time that they have shown life in weeks, so we should appreciate the SNP-backed benches, and isn't it amazing that they have shown life when it comes to attacking the Labour Party? Presiding Officer, a governing party under investigation by the police, sexual misconduct allegations, whistleblowers being silenced, division on the back benches, there's only one party that looks like the Tories and it's not us, it's the SNP. Because the First Minister is so out of touch, he insults the intelligence of people across Scotland. Labour would deliver a new deal for working people and scrap the Tory anti-trade union laws. Labour would deliver a publicly owned energy company, something promised and failed to deliver by the SNP. Labour would make Scotland an R&D powerhouse, not impose SNP cuts on universities. Labour would bring down people's bills with a proper windfall tax, not something the SNP and the Tories support, because that's the change that Scotland needs. Now, I know that the First Minister is still trying to find his feet. I know that the job can be quite confusing for him, but isn't it the case that he prefers a Tory Government because it's cover for his own incompetence? The First Minister is interested in, Presiding Officer. We're not interested in just getting rid of the Tories for a little while. We weren't rid of the Tory Government forever, and the way we do that is, of course, for voting for our independence. We don't want to replace Tory with Tory light or Tory with a pale imitation of Tories, and we know that Keir Starmer is lurching to the right. There are no more, the little more, than a Conservative Tribute Act. Just, of course, last week Labour was committed to keeping Tories' anti-protest legislation in place.  On progressive taxation, we are absolutely committed to leading the way in the Scottish Government on progressive taxation. What does Keir Starmer say when it came to income tax for the top 5% of earners? He said, we're in a different situation now. I think we've got the highest tax burden since World War 2. What about railways? Starmer, of course, was previously committed to nationalising railways. Now, he says that on water, rail and other services, and I quote, I take a pragmatic approach rather than an ideological approach. So what I say to Anna Savard is, we are prepared to work with any political party in order to keep the Tories out of number 10. Why is Keir Starmer refusing to work with the Scottish National Party in order to keep the Tories out of number 10? We are the most progressive party on these islands, but I say to Anna Savard, I don't want rid of Tory governments just for one year, just for five years, for one election cycle. We want rid of Tory governments in Scotland for good. Anna Savard, yet again, more interested in attacking Labour than getting rid of a Tory government. Again, it's interesting, it's really interesting. He didn't want to talk about poll ratings with me. Why? Approval rating minus 12, competent 22% and incompetent 40%. Trustworthy 18%. Untrustworthy 42%. Strong 19%. Weak 39%. Doing well 19%. Doing badly 44%. And the best of all, the best of all, better than his predecessor 9%, worse than his predecessor 41%. A pale limitation of Nicola Sturgeon—I'm not sure if that's a compliment any more—but the SNP and the Tories two sides of the same coin, both wanting division, chaos and damage labour, a Tory government, all about saving their jobs, not acting in the interests of the people of Scotland. Scotland is desperate for change and desperate to get rid of two failing Governments. Economically, illiterate and morally bankrupt Tory party are dysfunctional and incompetent SNP Government. If you want change to lower your bills, to give more money to people's pockets, to earn fire and rehire, to transform workers' rights, to create thousands of jobs, then surely— Mr Sarwar, I'm sorry to disrupt this session further, but members are doing a very, very good job on that account. I would be grateful if you could remember the basic rules of the code of conduct, which require that we conduct ourselves with courtesy and respect. I am seeing little of that, and that is not continuing. Mr Sarwar, if you could please put your question to the First Minister. They don't like it that the change is coming. They don't like it that they've been found out. They don't like it that they're plummeting. They don't like putting more money in the people's pockets with a proper windfall tax.  They don't like creating tens of thousands of new jobs. Mr Sarwar, so surely even the First Minister can see that this is the change that Scotland needs and that can only be delivered by a Labour Government. I'm grateful that you had to step in to save the branch manager of the Scottish Labour Party. Of course, the reason why Scotland won't trust Kier Starmers is because he has a born-again Brexit here. Remember, of course, Brexit has caused economic devastation to this country. Of course, Anna Sarwar said that he wants to see a changing relationship with the European Union. We want to see a relationship with the EU that means that Scotland is back in the European Union, that we rejoin the European Union, and the only way to do that, Presiding Officer, is of course as an independent nation in an independent country. However, here is the real proof about the fact that Kier Starmers Labour Party has lurched again to the right. The very first major speaking event that I went to was at the STUC. Anna Sarwar was there. One person that wasn't invited, of course, was Kier Starmer. Of course, the Dundee TUC brought forward a motion, the Dundee TUC brought forward a motion condemning Kier Starmers' actions and behaviours, so they may well be led by a party that is named after the founder of the Labour Party, but if Kier Hardy could see the state the Labour Party is in, he would be burling in his grave. Question 3, Gillian Mackay. To ask the First Minister whether the Scottish Government will consider a full ban on disposable vaping products on health and environmental grounds. First Minister. We will give that consideration littering, of course, of any kind, is unacceptable. I share the member's concerns about the environmental impact of single-use vapes, not to mention, of course, the increased use amongst children and young people, who should not have access to them in the first place. The Minister for Green Skills for the Circular Economy and Biodiversity has asked Zero Waste Scotland to examine the environmental impact of such products and consider what the options are to tackle the issue. This review is considering a whole range of possible options, including a ban. Any future approach will be informed by the findings of the review, but I should make it quite clear that the use of these products is an issue that we are taking very seriously, and nothing is off the table at this stage. I thank the First Minister for that answer and look forward to the publication of the report commissioned by the Minister. Vaping has serious environmental and health impacts. That is why campaigners such as Les Waste Laura, The Daily Record and a growing number of councils have highlighted those harms, and I thank them all for their work. A full ban on disposable vapes is needed, but does the First Minister agree with me that there is much that can be done ahead of a full ban to reduce harm? Keeping products away from public view, like cigarettes, raising awareness of the legal purchase age, highlighting disposable return points? Will the First Minister join me in calling on retailers to step up to the plate and implement those measures? Yes, I will join in that call, and we are keen to work constructively with retailers in that regard. I understand the many concerns around the environmental, but also the health impacts of single-use vapes that have been raised by campaigners, including Les Waste Laura, who Gilliam Mackay mentioned. Of course, our local government colleagues, whom I know, take this issue extremely seriously, have 15 councils who have now called for a ban. As well as the issues that the member raises around retailer responsibilities, they are being looked at in detail by the Minister for the Circular Economy and, indeed, the Minister for Public Health, as part of the review of the environmental impacts and, in our refresh tobacco action plan, which will be published in autumn later this year. That will include further action on education, but also crucially on enforcement, as we are, and I will keep the member updated on publication of that strategy. Thanks to the work of local campaigners, in February this year, Dundee City Council supported banning disposable vapes and called for a national ban from the Scottish Government, so, as there is already local support for such a ban, can I ask the First Minister what consideration the Scottish Government has given to introducing a pilot ban on disposable vapes in Dundee to help to develop a model for a national ban? I think that it is very well worthy of consideration, and as I referenced in my last response, there are around 15 councils who have called for a ban, but I am not surprised to see Dundee City Council, SMP-led Dundee City Council, of course, leading the way in this regard. I am more than happy to consider the issue of a potential pilot, but I think that it is important that the work that we have initiated through the review is allowed to happen, and I will ensure that that work, of course, is published, but we take immediate action because this is an issue of growing concern, both for the environmental impact that is having, but clearly for some of the health impacts that it is having too. Question 4, Fiona Hyslop. To ask the First Minister what the Scottish Government's position is on the view of the children and young people's commissioner for Scotland that NHS Lothian should review its children's rights impact assessment of the decision to end the youth navigator programme that operates at St John's hospital. The hospital youth navigator pilot will continue to be delivered by medics against violence and NHS partners at the Queen Elizabeth hospital for children in Glasgow, alongside the adult navigator programme in nine hospitals across Scotland. Navigators are key support workers who help individuals presenting at hospitals with multiple complex needs to access those support services. I understand that no decision about further future funding has yet been taken at this time and that NHS Lothian are evaluating all of their youth work provision in hospitals, including the pilot that is being referenced by Fiona Hyslop. A confirmed children's rights and wellbeing impact assessment will be undertaken on those proposed options. A final report is expected to be discussed at the children and young people's programme board at the end of this month. As the First Minister has acknowledged, the youth navigator is supported by Medics Against Violence, who have announced that funding will end at the end of June. He offers a youth work-based community outreach service to vulnerable young people at age 12 to 16, and he has accessed a time of presentation at St John's hospital in West Lothian, as well as the Sick Kids hospital in Edinburgh. Does he acknowledge that having debated a trauma informed approach to services only on Tuesday in this chamber, preventative youth work such as offered by the successful youth navigator programme should be supported, not withdrawn, and that a full child impact assessment would have flied the adverse childhood experiences, often present as a crisis on hospital presentation and early support and intervention action quickly can be most effective? Fiona Hyslop makes a very important point, indeed, and one that I fully subscribe to, particularly in my roles in justice and health previously, of course, taking that preventative trauma informed approach, particularly through the navigator's programme, can make a difference and has made a difference to many young people in this case in NHS Lothian. I value the importance of the service. Fiona Hyslop is absolutely correct in saying that the most effective approach, as I said, to dealing with these issues, is to take a trauma informed and preventative approach. I did reference in my previous answer that these matters are under review and that, of course, when it comes to the final provision of youth services in NHS Lothian, there is confirmation that children's right and well-being impact assessment will be undertaken, but I will ensure that the cabinet secretary for health and social care makes representations to NHS Lothian on the important issues that Fiona Hyslop has raised. First Minister, scrapping the service will have a devastating effect on vulnerable children and young people across the Lothian region. The QE hospital is hardly accessible. Many other youth work services have lost funding and statutory services like CAMHS are at breaking point. Cutting back on youth work is the wrong course of action and will just store up problems for the future. We hear so often about the preventative approach being championed by the Scottish Government and this project does exactly that, so why are we even considering cutting it? Can I say to Sue Webber that I agree with the approach in relation to preventative funding? Of course, this Government funds medics against violence in excellent organisation, who have had the pleasure of meeting a number of times over the years. We fund them to the tune of £337,000 in terms of this financial year and deliver a variety of violence prevention activity, including the core activity, to deliver and support the national hospital navigator programme. I go back to the answer that I referenced to Fiona Hyslop. This is a decision that NHS Lothian is reviewing. It is looking at the youth service provision in the round and, of course, it will do that important impact assessment that Fiona Hyslop has called for. I am more than happy that the Government makes representations to NHS Lothian on the back of what has been said in the chamber today. Ultimately, of course, it will be a decision for NHS Lothian to take and I would expect them to do the full impact assessments in this regard. To ask the First Minister what action the Scottish Government is taking to support colleges and universities in Scotland. Colleges and universities make a crucial and unique contribution to Scotland. We are investing nearly £2 billion in the sectors each year through the Scottish Funding Council. When we make this funding flexible, where possible, I recognise the challenges, I recognise the pressures that colleges and universities are currently facing and, of course, we will continue to engage with the Scottish Funding Council, as well as the sectors directly to ensure that institutions are financially stable. Two weeks ago, the SNP Government took a dagger to the heart of colleges and universities by cutting £46 million of funding that was only announced in December with no warning and no consultation. When the Scottish budget was announced, the Scottish Government trumped a £12.7 million increase for higher education five months on from the budget. That is now a £7.3 million cash cut between financial years. Since then, I have also received a letter from the City of Glasgow College stating that its intention is to begin a process of 75 compulsory redundancies. Despite claiming that education was her number one priority, the previous First Minister, Nicola Sturgeon, failed Scotland's young people. So, can I ask the First Minister what is he going to do to prevent history from repeating itself? First Minister. When it comes back to the question of the former First Minister, I remind you that there are more young people from areas of deprivation going to university now than there ever have been before. That is down to the legacy of Nicola Sturgeon, the closing of the poverty-related attainment gap because of the actions of the former First Minister. On the savings that we have had to make—those are difficult decisions that we have to make. I am not going to downplay the significance and the effect that that saving will have on both the colleges and university sectors, but just to put it into some context, it is 2.3 per cent of the £2 billion budget for further education and for higher education in 2023-24. However, why did we have to make that saving? We had to make it because every single party, I think rightly, stood here and demanded that the Scottish Government intervened, demanded that we help to assist local government in relation to settling the teachers' paid dispute. An additional £320 million had to be found to do that. It does not just grow in the proverbial magic money tree, so tough decisions had to be made. We were upfront about that, so we will take those tough decisions. We certainly will not take lectures from a Conservative member of course, their party, the reason why we are facing the financial constraints on the Scottish public finances. Can I remind Pam Gosol, because of sky-high inflation, because of the decisions taken by a Conservative Government, our Scottish finances last year were worth £1.7 billion less at peak inflation because of the economic carnage her party inflicted upon Scotland. We will take the tough decisions needed. We certainly will not take any lectures on financial and economic literacy from the Conservative party. Sally Marston, the head of University Scotland, described the Scottish National Party Government's policy on universities as managed decline. Why does the First Minister think that this multi-million-pound cut to the university's budget is going to reverse that managed decline? I do not agree with that characterisation. I am more than happy to meet Dame Sally Marston and other university and college principals in the course of the coming weeks, months and years to come, because I take her views very seriously indeed in terms of the characterisation of managed decline. Can I remind Willie Rennie that the latest higher education stats show that a record number of Scottish domiciled students are studying at Scottish universities? We have some of the best universities in the world, world-class universities. That is because of the excellent initiatives by those universities and the excellent education that they provide. It is also down to the funding that the Scottish Government has put into a higher education and further education sector for many years to come. I am more than happy to engage with the university and college principals, but I simply do not accept its managed decline when we have such world-class universities such as St Andrews that are being funded by the Scottish Government. I refer to my entry in the register of members' interests to ask the First Minister what the Scottish Government's position is on the potential impact of the proposed timetable reductions by ScotRail on efforts to secure a modal shift from car to train. My understanding is that, as a result of ScotRail's new May 2023 timetable, the number of daily services remains the same with no overall reduction and the resources are being focused on areas to better serve current demand. As a result, peak trains and school connections have been prioritised in order to support that very modal shift that Katie Clark refers to. I want to make Scotland's public transport system more accessible, more available and more affordable. That is why I confirmed last month that the six-month pilot to remove peak time fares from ScotRail services will start in October of this year. That intervention, which is unprecedented in the UK rail sector, will enable officials to gather evidence right across transport modes for the fair fair's review and to inform future proposals, while encouraging modal shifts. I thank the First Minister for his answer. However, despite the Scottish Government's goal of reducing car use by 20 per cent by 2020, ScotRail is proposing to cut many train services, including many commuter services such as the 742Am LARGs to Glasgow service. Will the First Minister look at the case for maintaining the 742 LARGs to Glasgow service? Will she agree with me that we need to do far more to encourage people to use the railways rather than cars if we are to achieve our climate change target? Will she carry out an assessment of how the timetable changes being proposed by ScotRail will impact on meeting those goals? I agree with the absolutely underlying premise of Katie Clark's question. It is so important that we make public transport available, affordable, as best we possibly can and as accessible as we possibly can in order to get that modal shift away from car to public transport. On the very operational matters that she refers to, I will ensure that transport secretary does engage with ScotRail, but they are operational matters for ScotRail. On the 742 from LARGs to Glasgow, my understanding is that it has been replaced by the 754 from Addrossan to Glasgow. An additional train has been added to the timetable from Addrossan to Glasgow departing at 7.26. The May 2023 timetable will also provide journey saving times for those passengers travelling on the air to Glasgow route. Following on from customer feedback, the Addrossan and LARGs services will now call its stations in the Garnac valley to improve connections. There have been changes that have been made right across the timetable directly influenced by user feedback. I would say to Katie Clark that she is absolutely right. We need to continue to do more in order to ensure that that modal shift happens between car and public transport. That is why I am pleased that my First Minister announced the beginning of the pilot to abolish peak rail fares that will run for six months from October this year. John Mason Thank you. Can the First Minister confirm that passenger numbers have not returned to pre-Covid levels partly because people are working at home? That means a shortfall in cash for either the railways of the Government. Can he confirm how that shortfall is being made up? John Mason is absolutely right to raise the issues that he does. Clearly passenger numbers are still recovering from the pandemic, so income levels are still down. But Scotland's rail operators are also having to meet those really high inflationary costs that are affecting every single business, every single person right now. All of that impacts on our rail budget, but I understand that the cost of implementing the May 2023 timetable change is, hopefully, projected to be neutral. It is difficult to accurately assess the exact financial impact of passenger numbers that have not yet returned to pre-Covid levels, but it is good that demand continues to increase incrementally and has currently recovered to over two-thirds of pre-Covid levels. Clearly, we want Scotland's publicly controlled railways to succeed, both in the short and the long term. ScotRail has been working hard through a range of promotions in recent months to encourage more people to travel by train, not least because of the contribution that rail can and should make and will make to addressing climate change and cutting transport emissions. We move to general and constituency supplementaries, and I call Clare Adamson. Thank you very much, Presiding Officer. Following the tragic death of Haimie Carsey in Mallorca due to a suspected carbon monoxide leak in a holiday home, I know that the chamber's thoughts and condolences will be with Mr Carrey's friends, loved ones and especially his wife, now recovering. The dangers of carbon monoxide are frequently a subject for the cross-party group on accident prevention and safety awareness. Regulation is very greatly, both here and abroad, so does the First Minister agree that members of the public should consider heeding the advice from organisations such as ROSPA and the Safer Tourism Foundation and consider a carbon monoxide alarm as essential holiday packing? Yes, I agree with that. My thoughts are with the family of Jamie Carsey and, indeed, with his wife, Mary, who remains in a very serious condition in hospital and, of course, with her friends and family in the community that will be deeply saddened and rocked by those events. A carbon monoxide detector can give people an important life-saving warning of a faulty appliance. In Scotland, it is a legal requirement to include a carbon monoxide detector in any room with a carbon-fuelled appliance. One of those detectors is vital for safety. It could literally, quite literally save your life, so I would encourage everyone to find out about the importance of being aware of the signs of carbon monoxide poisoning and the actions that can keep them safe as well. You can find more information on, in all one word, gas-safety-register.co.uk. Sorry, I will say that again, gas-safe-register.co.uk. More information can be found, but I hope that Mary Somerville, the wife of Jamie Carsey, continues, hopefully, to recover. My thoughts are with her and the family of Jamie Carsey. Yesterday, the fight to save six libraries and Buxburn swimming pool in Aberdeen moved to the courts. Will the First Minister contact the SNP administration at Aberdeen City Council and tell them to get a grip, listen to the people they are meant to serve and not fight them in the courts? Or is this yet another example of the SNP failing the people of the north-east? Before the First Minister responds, I will remind members again that questions to the First Minister should be put on matters for which the Scottish Government have general responsibility. Of course, it is the SNP-led Government that has increased funding for local Government. Of course, it would be Douglas Lumsden who would be the first one to complain if we interfered and intervened in local decisions that are being made. What I will not do is comment on any potential live court proceedings that are taking place, but we have increased funding to local government. We respect the decisions that are being made by local government, and it is their right to make those decisions under section 163 of the Local Government Act 1973. We will continue to make sure that we fund local government, but what we will not do is intervene and interfere in those locally made decisions. Monica Lennon This evening, alongside the STUC and the Sunday Mail, I am hosting a parliamentary reception to celebrate the Food for Thought campaign and the positive impact of universal free school meals across Scotland. All MSPs are invited, and we hope that the First Minister can join to hear directly from young people how access to universal free school meals is reducing poverty, inequality and stigma. Further to comments that he reportedly made in the daily record, can the First Minister provide an update on the roll-out of universal free school meals in primary schools and on the pilot programme to be launched in secondary schools? I can say to Monica Lennon and others that I have an interest in this issue. Of course, the SNP-led Government is the party of universalism. That is why, of course, we abolished tuition fees. Something that Keir Starmer's Labour Party, of course, is not going to be doing. It is why we are the party of the baby box. It is why we are the party, of course, that has introduced universal free school meals P1 to P5. And yes, of course, it did not have a manifesto commitment and remain committed to the future roll-out in terms of P6 and P7. Of course, looking at a pilot as well in secondary schools, I simply made the point and I continued to make the point. I made this point at the anti-poverty summit that we will look at what more we can do around progressive taxation. We will, because of the economic carnage that has been inflicted upon us by the UK Government, have to look at making really tough decisions. We will have to look at targeting across a range of potential policy areas. There is not a conflict between universalism and being targeted. Yes, there are some rights that should be universal, such as the right to a free education, to free university education. They are rights, they are not benefits, they are not luxury. At the same time, we should absolutely make sure that we are being targeted where we can, such as, for example, the Scottish child payment, that game-changing intervention, which is helping the poorest in our society. We are the party that is, of course, the party of universalism, but also the party that makes sure that we target our resources towards those who absolutely need the most help, particularly in the face of a UK Government that is inflicting harm upon harm on the poorest in our society. Gareth Ewing. Oeson, unctrulled brakin is the perfect breeding ground for ticks, ticks that carry diseases that infect humans, such as the debilitating Lyme's disease. Will the First Minister end the delay and instruct the authorisation of acylox, the only effective treatment in order to control brakin? Given that time is running out, both for its procurement and use in the available season, will he do that straight away? If not, does he appreciate that the outcome will be likely the widespread infection of many human beings with this dreadful Lyme's disease? I will look into the serious issue that Fergus Ewing raises. The Scottish Government recognises the concerns about the potential risk of uncontrull brakin and the difficulties associated with its control, particularly here in Scotland. Acylox is a herbicide that has no current EU or UK authorisation. There are specific legislative conditions that must be met in order to grant an emergency authorisation of the product to ensure that high level of protection for human health and for the environment. HSE is responsible for assessing emergency authorisation applications right across the UK against the legislative requirements. The Scottish Government considered and promptly responded to HSE's recommendation that HSE, my understanding, will issue the decision to the applicant once all other UK Governments have responded. The Scottish Government is aware of the importance of effective pesticides when used as part of an integrated approach, and our position is very much guided by regulation and, importantly, crucially, by scientific evidence too. This week, three quarters of people surveyed said that they think that we should meet our domestic energy needs from UK oil and gas production rather than imports. This Government's energy strategy specifically includes a presumption against new exploration and production in the North Sea. Yesterday, the First Minister tried to please both sides of the debate, yet carefully committed to neither. Here is the chance to get off the fence. Given the need for energy security to protect thousands of Scottish jobs and the climate benefits of local production, will he remove from the energy strategy this Government's intention to close down the North Sea? What the Government will do is listen to those consultation responses. It just closed a couple of days ago. We have had more than 1,500 responses. We will analyse them carefully, but there is no doubt at all that we are absolutely committed to a just transition, a transition away from oil and gas, but it is portally and crucially for our economy and for our planet to make sure that we unleash the potential of the green economy. We have to make sure that we live up to our climate obligations, both domestic targets and international obligations. We have to make sure that we are playing our part in energy security, again domestically, but also internationally, too. However, what we absolutely will not do is what the Liam Kerr Conservatives did to the mining and steel communities in the 1970s and 1980s. We will not throw a single worker in the north-east on the scrap heap during this just transition process. What you will see from the Scottish Government when it comes to unlocking our green potential is action. What we are seeing from the UK Government is complete and utter inaction. For example, failing to make any meaningful progress on investment in the Scottish cluster or, indeed, on the ACORN project, in particular, complete and utter abject failure in action from the UK Government, whereas we will take action to make sure that we unleash the potential of the green economy, not just in the north-east, but for the whole of Scotland. That is important because we want to invest and unlock the potential for our economy, but it is also a moral imperative to ensure the sustainability of our planet in the future. Thank you, Presiding Officer. The economy secretary has now said that he would like to see Ferguson Marine return to private ownership as soon as possible. The GMB rightly says that the Ministry of Defence work from BAE is a sign of confidence in the workforce, and the Scottish Government should follow suit by developing a plan for the direct award of smaller vessels with robust oversight in place. The GMB, a right changing ownership and plunging the workforce into more uncertainty, is not the solution. It is important that we listen to them. In fact, if their warnings had been listened to earlier, perhaps we would not have the fiasco we have now. Does the First Minister not accept that, given this whole mess is of the Government's making, it is the Government's job to clear it up? First Minister, of course the Government stepped in and saved hundreds of jobs on the Clyde. We saved hundreds of jobs. I make no apology for that. Of course, there have undoubtedly been challenges that the Government has fronted up. When it comes to GMB's letter on the issue of public versus private ownership, what Neil Gray said has been the Government's position for a long time? It has always been the intention of the Scottish Government to return Ferguson's Marine to private ownership. Indeed, that was made clear when we announced the yard being taken into public ownership in the very first place. There is not much—having seen the GMB letter, there is not much in the GMB letter that we disagree with. We want to work with them, with a wider workforce to secure the best possible future and the outcome for the yard, because we do absolutely have faith in that workforce and in the future of the yard. Investment in the yard is about more than just profitability. It is important, of course, as that is. It is also about the retention of skills around jobs, manufacturing capability. Those will be key considerations in any decision over the future of the yard. Any deal to see the yard return to private ownership must prevent value for money, but let me be absolutely unequivocal about it. It must also ensure that it continues the good work on fair work, which is at the heart of everything that this Government does. The next item of business is a member's business debate in the name of Rachel Hamilton, and there will be a short suspension to allow those leaving the chamber and public gallery to do so.


We use batteries for just about everything in our lives. From our cell phone to our laptops, even a car runs on a 12V battery. Which provides enough power to its motor and other parts like the music system or head and tail lights. We have also seen and used these smaller batteries. These are called AA batteries and we use them in torches, glocks or even cameras. There is some difference between the battery of a car and these batteries. The difference lies in the chemistry behind them, but the main purpose still remains the same. They are used to provide enough power for the devices to work. And here's a wild question. Do you think it's possible to start a car, one that you can actually sit in and drive, using these simple household AA batteries like the ones that we see in torches and glocks? Well, the short answer is yes we can, it's possible. Let's see how. Now the motor that is used in the car is called a starter motor, it looks somewhat like this. And it draws a huge amount of current so that it can get the engine going. It draws on an average 250A of current and operates at 12V. This is a very high requirement of voltage and current. And AA batteries are usually rated at 1.5V and they have an internal resistance of again on an average 0.2 ohms. If you want to start a car using these, we would need a bunch of them. Since the AA battery has an internal resistance, the voltage drop across its terminals is called the terminal voltage and this is given by E-IR, where E is 1.5V, R here is the internal resistance. Now the battery can provide a maximum of 7-8A of current, 7-8A of current can be drawn from the battery. But the battery may become extremely hot from doing this. And there is a possibility of the battery either venting a hot gas or the container exploding from the pressure buildup inside. So this is somewhat risky to do. So let's work with two amperes. Using two amperes is a lot of current, but let's say that we want two amperes to be drawn from the battery and then let's try to get a sense of how many of these batteries would we need in that case. So if two amperes of current is flowing over here, the terminal voltage would be, this over here is 1.5, minus 2 into 0.2 and this comes out to be equal to 1.1V. So this AA battery will supply a voltage of 1.1V when two amperes of current is being drawn from it. But the motor requires 12V. So to meet the voltage requirement of the motor, we would need to put a bunch of these batteries in series because voltage gets added up in series, right? Let's see how many of these would we need to connect in series. The voltage requirement is 12V and one battery is providing 1.1. So 12 divided by 1.1. This comes out to be approximately equal to 11. So we would need to place 11 AA batteries in series and only then we will be able to meet the voltage requirement of 12V. So let's do that and see how it looks. We have 11 AA batteries in series and we meet the voltage requirement by connecting them in series. But the current is still two amperes. We haven't met the current requirement. The current requirement is 250 amperes and two amperes of current would be flowing in this string of series connected batteries. So if we have 125 of such series connected batteries in parallel to each other then the current in each branch would be two amperes and the total current would come out to be as 250 amperes meeting the current requirement. So we would need to add more batteries in parallel to form a series parallel or a mixed combination and we can connect them to each other to form the entire circuit. This means that the total number of AA batteries for starting a car would be 125, 125 x 11 and this is 1375 number of batteries. We can start the car with even more or less than 1375 batteries. This is not a fixed number. If we want much less current to be drawn from the batteries, we would need more of these thousands more. And if we want less number of batteries, more current will have to be drawn from each, but that involves a lot of risk. So these batteries will be drained very soon and some of them are rechargeable, some aren't. But the idea of connecting them in series, in series to meet the high voltage requirement and connecting them in parallel to meet the high current requirement is followed even in the battery packs used in electric cars such as those made by Tesla. Batteries that are used in Tesla, however, have a very high voltage rating and can be recharged but they are also connected in a mixed combination, both in series and parallel to meet the voltage and the current requirements.