SQL in Python

Опубликовано: 23 Август 2018
на канале: Python Marathon
395
4

Descargar el Código: patreon.com/pythonmaraton

Join Patreon: patreon.com/pythonmaraton
^Downloadable code & more! This video shows you that you can use SQL in python with the package sqlite3. SQL is great for data science and you can use aspects of it in python. This shows you some table manipulation examples from real data (though small data) from the Utah Jazz, to help introduce some of the syntax

This is a Python anaconda tutorial for help with coding, programming, or computer science. These are short python videos dedicated to troubleshooting python problems and learning Python syntax. For more videos see Python Help playlist by Rylan Fowers.

✅Subscribe:    / @pythonmaraton  

📺Channel:    / @pythonmaraton  

▶️Watch Latest Python Content:    • Python String Slice and List Slice  

▶️Watch Latest Other Content:    • Video  





SQL (SEQUEL)

I am briefly going to show you how you can use SQL (sequel) in python.

I have a code I already made. So I’m going to use it as the example today.

First let’s run the code and show you the output.

Here is the code I wrote using atom. This takes data from four different tables, from real data of the utah jazz.

These are small data sets, just for the purpose of the example

I have the data as csv files and I pulled them up in excel so you can see them.

Using SQL we are prepared to answer some questions, so let me walk you through some of this syntax.

So here se created some tables

For player salary, we will take the first and last name of players from the Positions table and inner join that with the salaries table based on the player id and grouped by the amount of salatry. This will create our list player_salary, full of tuple of players first and last names, ordered from smallest salary to largest.

So if we want to know the third highest paid player, we can just grab the third to last or the tuple in the negative 3 spot, which in this case was Joe Ingles

Now let’s look at this no_score_players list. This will take first and last names again from the players table. but this time we do a left outer join with scored goals where the player ids match up and where the goal value is null or missing.

This gives a list of all the players who did not score in the data we have. And here they are all printed out.

I hope you are familiar with SQL (sequel) because it is very important for data science.

To use a version of it in python just remember to import sqlite3

and there you have it, that is an example of how you can use SQL in python

#PythonMarathon #LearnPython #PythonTutorial


На этой странице сайта вы можете посмотреть видео онлайн SQL in Python длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Python Marathon 23 Август 2018, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 395 раз и оно понравилось 4 зрителям. Приятного просмотра!