- Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Python Tutorial for Beginners 4: Lists, Tuples, and Sets

In this Python Beginner Tutorial, we will begin learning about Lists, Tuples, and Sets in Python. Lists and Tuples allow us to work with sequential data, and Sets allow us to work with unordered unique values. We will go over most of the methods, learn when to use which data type, and also the pe...
In this Python Beginner Tutorial, we will begin learning about Lists, Tuples, and Sets in Python. Lists and Tuples allow us to work with sequential data, and Sets allow us to work with unordered unique values. We will go over most of the methods, learn when to use which data type, and also the performance benefits of each type as well. Let's get started.

The code from this video can be found at:
https://github.com/CoreyMSchafer/code_snippets/tree/master/Python-Lists

Watch the full Python Beginner Series here:
https://www.youtube.com/playlist?list=PL-osiE80TeTskrapNbzXhwoFUiLCjGgY7

Slicing Video: https://youtu.be/ajrtAuDg3yw


✅ Support My Channel Through Patreon:
https://www.patreon.com/coreyms

✅ Become a Channel Member:
https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join

✅ One-Time Contribution Through PayPal:
https://goo.gl/649HFY

✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey's Public Amazon Wishlist
http://a.co/inIyro1

✅ Equipment I Use and Books I Recommend:
https://www.amazon.com/shop/coreyschafer

▶️ You Can Find Me On:
My Website - http://coreyms.com/
My Second Channel - https://www.youtube.com/c/coreymschafer
Facebook - https://www.facebook.com/CoreyMSchafer
Twitter - https://twitter.com/CoreyMSchafer
Instagram - https://www.instagram.com/coreymschafer/

#Python

#Python #Python Lists #Python Tuples #Python Sets #Python Data Types #Python for Beginners #Absolute Beginners #Python for Absolute Beginners #Python Basics #Getting Started with Python #Python 3.6 #Python 36 #Python 3
List : - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

List :

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:00:00 - 00:20:05
Actually, you can see the first arg of courses[] as the initial index and the second as the number of items that will be return, or the length of a new array - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Actually, you can see the first arg of courses[] as the initial index and the second as the number of items that will be return, or the length of a new array

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:00:02 - 00:29:05
Can you say at print(courses()) this:  "Take, from the beginning, the first two items?" - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Can you say at print(courses()) this: "Take, from the beginning, the first two items?"

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:00:02 - 00:29:05
courses[] from 0 index up to but not including 2courses[:2] or courses[2:]courses.append('Art')courses.insert(0, 'Art') insert at indexcourses.insert(0, courses_2) inserts whole LIST AS ONE ITEM into a list using indexcourses.extend(courses_2) joins two lists by each individual items in a listscourses.remove('Math')courses.pop() removes and returns removed valuecourses.reverse() reverses in placecourses.sort(reverse=True) sorts in descendingsorted_courses = sorted(courses) for sorting not in placemin(num), max(num), sum(num)courses.index('CompSci') shows the index of item'Art' in courses shows True or False, contains or notfor index, course in enumerate(courses, start = 1): loops through each item in courses using index that starts with 1course_str = ' -  '.join(courses) converts a list into a string using separatornew_list = course_str.split(' - ') converts a string into a list using separator - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

courses[] from 0 index up to but not including 2courses[:2] or courses[2:]courses.append('Art')courses.insert(0, 'Art') insert at indexcourses.insert(0, courses_2) inserts whole LIST AS ONE ITEM into a list using indexcourses.extend(courses_2) joins two lists by each individual items in a listscourses.remove('Math')courses.pop() removes and returns removed valuecourses.reverse() reverses in placecourses.sort(reverse=True) sorts in descendingsorted_courses = sorted(courses) for sorting not in placemin(num), max(num), sum(num)courses.index('CompSci') shows the index of item'Art' in courses shows True or False, contains or notfor index, course in enumerate(courses, start = 1): loops through each item in courses using index that starts with 1course_str = ' - '.join(courses) converts a list into a string using separatornew_list = course_str.split(' - ') converts a string into a list using separator

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:00:02 - 00:29:05
print(courses[]) #['history', 'maths']print(courses[:2])  #['history', 'maths']print(courses[2:])  #['physics', 'compsci'] - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

print(courses[]) #['history', 'maths']print(courses[:2]) #['history', 'maths']print(courses[2:]) #['physics', 'compsci']

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:00:02 - 00:29:05
-  Lists - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

- Lists

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:01:00 - 00:22:03
print(courses[]) - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

print(courses[])

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:02:05 - 00:29:05
what happens when we put negative value but in case me i got 1 as output but why please explain Thanks for this great Series Of Python Tutorials - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

what happens when we put negative value but in case me i got 1 as output but why please explain Thanks for this great Series Of Python Tutorials

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:03:10 - 00:29:05
, why does courses[4] not just output History by looping backwards, since 4 is ahead of the range. - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

, why does courses[4] not just output History by looping backwards, since 4 is ahead of the range.

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:03:21 - 00:29:05
So I'm up to the  minute marker and I'm just now realizing that this is similar to your Intro to Slicing video.  Thank you so much for these great videos!!!! - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

So I'm up to the minute marker and I'm just now realizing that this is similar to your Intro to Slicing video. Thank you so much for these great videos!!!!

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:04:00 - 00:29:05
physics is actually  the third index in the list but you said the second - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

physics is actually the third index in the list but you said the second

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:05:00 - 00:29:05
I just got to the  minute marker.....lol - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

I just got to the minute marker.....lol

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:05:04 - 00:29:05
It's an instructive video! Hi, did you use Python or Idle when you were teaching us? From  to 6:41, you used append command first, then insert command, but why your list did not update after using append command? I see that when you printed insert command, your list had only one Art. - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

It's an instructive video! Hi, did you use Python or Idle when you were teaching us? From to 6:41, you used append command first, then insert command, but why your list did not update after using append command? I see that when you printed insert command, your list had only one Art.

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:05:37 - 00:29:05
ReferI suppose .pop() is a function, so that when you write courses.pop() in the code it deleted the last element of the list, fair enough. - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

ReferI suppose .pop() is a function, so that when you write courses.pop() in the code it deleted the last element of the list, fair enough.

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:09:53 - 00:29:05
At around  min mark you were telling us about sort( ) method, extend( ) method, but near the end of the video we are learning about -  list( ) class, tuple( ) class? - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

At around min mark you were telling us about sort( ) method, extend( ) method, but near the end of the video we are learning about - list( ) class, tuple( ) class?

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:11:00 - 00:29:05
How do you do that magic at  ? you simply write some numbers divided only with comma, and then suddenly boom space appears :D - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

How do you do that magic at ? you simply write some numbers divided only with comma, and then suddenly boom space appears :D

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:11:00 - 00:29:05
Hi Corey, can you tell me how you did that sort of "trick" at ? You defined the nums list with no spaces between the commas, then you hit something and it added the whitespaces :D - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Hi Corey, can you tell me how you did that sort of "trick" at ? You defined the nums list with no spaces between the commas, then you hit something and it added the whitespaces :D

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:11:02 - 00:29:05
he puts a spaces after each element, how do you do that? - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

he puts a spaces after each element, how do you do that?

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:11:02 - 00:29:05
@ How can you put spaces between items automatically? - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

@ How can you put spaces between items automatically?

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:11:03 - 00:29:05
at  he says we don't need to reset our variables, what does he mean? - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

at he says we don't need to reset our variables, what does he mean?

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:11:50 - 00:29:05
hey Corey. Why is my cancel Build greyed out and cant work. I cant cancel build like you did at - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

hey Corey. Why is my cancel Build greyed out and cant work. I cant cancel build like you did at

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:12:14 - 00:29:05
Great video. A little bit confused at . why the "sorted" function doesn't sort the list in place ? - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Great video. A little bit confused at . why the "sorted" function doesn't sort the list in place ?

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:12:40 - 00:29:05
At  you forgot to mention that the index function only returns the index of the first occurrence of the item. So it's not very useful when using a list that might include multiple identical objects. - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

At you forgot to mention that the index function only returns the index of the first occurrence of the item. So it's not very useful when using a list that might include multiple identical objects.

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:14:45 - 00:29:05
At  when discussing changing the variable from "item" to "course" in the for loop, you somehow simultaneously changed that variable in the indented print function as well. What did you press on the keyboard to do that?  I'm a mac user. - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

At when discussing changing the variable from "item" to "course" in the for loop, you somehow simultaneously changed that variable in the indented print function as well. What did you press on the keyboard to do that? I'm a mac user.

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:16:38 - 00:29:05
for index, course in enumerate(courses, 1):print(index,  course) - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

for index, course in enumerate(courses, 1):print(index, course)

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:17:47 - 00:29:05
for anyone who needs a timestamp - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

for anyone who needs a timestamp

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:17:48 - 00:29:05
Hi Corey, Thanks for the wonderful videos. Output for my program differs from what's shown in the video at , its printed in braces and with a comma and single quotes. I am using python 2.7. Any idea on how to get the output similar to shown in the video with python 2.7. - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Hi Corey, Thanks for the wonderful videos. Output for my program differs from what's shown in the video at , its printed in braces and with a comma and single quotes. I am using python 2.7. Any idea on how to get the output similar to shown in the video with python 2.7.

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:17:53 - 00:29:05
at  i think he meant space hyphen space. Other than that a really good video!!! - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

at i think he meant space hyphen space. Other than that a really good video!!!

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:19:53 - 00:29:05
Tuple : - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Tuple :

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:20:05 - 00:23:34
Tuples and sets starts at - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Tuples and sets starts at

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:20:05 - 00:29:05
- Tuples section - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

- Tuples section

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:20:12 - 00:29:05
I couldn't understand why a change in list_1 in line 8 , causes change in list_2?? since the assignment of list_2 = list_1 is done in line 2, why that change affects list_2? - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

I couldn't understand why a change in list_1 in line 8 , causes change in list_2?? since the assignment of list_2 = list_1 is done in line 2, why that change affects list_2?

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:21:28 - 00:29:05
There's one thing here that struck me: I'm not new to programming in general but the behavior in  ( _both_ lists changing) was quite shocking to me :-) I had a slight hunch what was happening there but still I had to look it up and found this: https://stackoverflow.com/questions/2612802/how-to-clone-or-copy-a-list (for all you guys out there who got confused). - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

There's one thing here that struck me: I'm not new to programming in general but the behavior in ( _both_ lists changing) was quite shocking to me :-) I had a slight hunch what was happening there but still I had to look it up and found this: https://stackoverflow.com/questions/2612802/how-to-clone-or-copy-a-list (for all you guys out there who got confused).

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:21:28 - 00:29:05
In code during , when we assigned list2 equal to list1(it had list1[0]=history)  and later we make change to list1 only then why this change gets updated in list2 too? - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

In code during , when we assigned list2 equal to list1(it had list1[0]=history) and later we make change to list1 only then why this change gets updated in list2 too?

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:21:32 - 00:29:05
Please, can you tell me how did you just comment all of these lines that fast @Update: it's (Ctrl + forward dash) - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Please, can you tell me how did you just comment all of these lines that fast @Update: it's (Ctrl + forward dash)

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:22:00 - 00:29:05
Hi Corey, great vid. One question: How did you comment out several rows? (Minute ) - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Hi Corey, great vid. One question: How did you comment out several rows? (Minute )

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:22:02 - 00:29:05
- Tuples - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

- Tuples

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:22:03 - 00:23:35
LIst : - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

LIst :

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:23:34 - 00:29:05
- Sets - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

- Sets

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:23:35 - 00:29:05
= Sets - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

= Sets

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:23:35 - 00:29:05
Sets - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Sets

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:23:37 - 00:29:05
whatsap at - Python Tutorial for Beginners 4: Lists, Tuples, and Sets

whatsap at

Python Tutorial for Beginners 4: Lists, Tuples, and Sets
2017年05月18日
00:27:00 - 00:29:05
Corey Schafer

Corey Schafer

🎉 990,000 人達成! 🎉

【予測】100万人まであと10日(2022年10月17日)

チャンネル登録 RSS
Welcome to my Channel. This channel is focused on creating tutorials and walkthroughs for software developers, programmers, and engineers. We cover topics for all different skill levels, so whether you are a beginner or have many years of experience, this channel will have something for you.

We'...
Welcome to my Channel. This channel is focused on creating tutorials and walkthroughs for software developers, programmers, and engineers. We cover topics for all different skill levels, so whether you are a beginner or have many years of experience, this channel will have something for you.

We've already released a wide variety of videos on topics that include: Python, Git, Development Environments, Terminal Commands, SQL, Programming Terms, JavaScript, Computer Science Fundamentals, and plenty of other tips and tricks which will help you in your career.


If you enjoy these videos and would like to support my channel, I would greatly appreciate any assistance through my Patreon account:
https://www.patreon.com/coreyms


You can find me on:
My website - http://coreyms.com/
Facebook - https://www.facebook.com/CoreyMSchafer
Twitter - https://twitter.com/CoreyMSchafer
Google Plus - https://plus.google.com/+CoreySchafer44/posts
Tumblr - https://www.tumblr.com/blog/mycms

Timetable

動画タイムテーブル

動画数:127件

A OAuth Django video would be awesome!(Applicable to all sorts of OAuth situations, not just the YouTube API.) - Python YouTube API Tutorial: Using OAuth to Access User Accounts

A OAuth Django video would be awesome!(Applicable to all sorts of OAuth situations, not just the YouTube API.)

Python YouTube API Tutorial: Using OAuth to Access User Accounts
2020年09月10日
00:07:58 - 00:43:21
At  you move the file and see some blurred miniature version of your open folders in the dock. How did you enable that? - Python YouTube API Tutorial: Using OAuth to Access User Accounts

At you move the file and see some blurred miniature version of your open folders in the dock. How did you enable that?

Python YouTube API Tutorial: Using OAuth to Access User Accounts
2020年09月10日
00:09:58 - 00:43:21
In case you are getting Error 403 ("access_denied The developer hasn’t given you access to this app") go to the OAuth consent screen and under Test Users add your email by clicking on Add Users.  You should be able to grant access after you've added User. - Python YouTube API Tutorial: Using OAuth to Access User Accounts

In case you are getting Error 403 ("access_denied The developer hasn’t given you access to this app") go to the OAuth consent screen and under Test Users add your email by clicking on Add Users. You should be able to grant access after you've added User.

Python YouTube API Tutorial: Using OAuth to Access User Accounts
2020年09月10日
00:19:36 - 00:43:21
@corey  So why did you add the join function here, when appending the video id to the list its already a list and its working for me when I pass the vid_ids directly - Python YouTube API Tutorial: Calculating the Duration of a Playlist

@corey So why did you add the join function here, when appending the video id to the list its already a list and its working for me when I pass the vid_ids directly

Python YouTube API Tutorial: Calculating the Duration of a Playlist
2020年06月11日
00:11:24 - 00:37:38
TypeError: expected string or bytes-like object, I am taking this error in , any idea? - Python YouTube API Tutorial: Calculating the Duration of a Playlist

TypeError: expected string or bytes-like object, I am taking this error in , any idea?

Python YouTube API Tutorial: Calculating the Duration of a Playlist
2020年06月11日
00:18:50 - 00:37:38
(I love that "Whoops that went too well"-moment at  :D) - Python Tutorial: Real World Example - Using Patreon API and Pillow to Automate Image Creation

(I love that "Whoops that went too well"-moment at :D)

Python Tutorial: Real World Example - Using Patreon API and Pillow to Automate Image Creation
2020年05月11日
00:35:19 - 00:52:33
Read CSV - - Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

Read CSV -

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc
2020年04月02日
00:00:56 - 00:03:20
Write CSV - - Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

Write CSV -

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc
2020年04月02日
00:03:20 - 00:04:40
Write TSV - - Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

Write TSV -

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc
2020年04月02日
00:04:40 - 00:06:00
Read TSV - - Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

Read TSV -

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc
2020年04月02日
00:06:00 - 00:06:15
Write Excel - - Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

Write Excel -

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc
2020年04月02日
00:06:15 - 00:10:42
Read Excel -  (Start at 6:15 to see installed packages) - Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

Read Excel - (Start at 6:15 to see installed packages)

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc
2020年04月02日
00:10:42 - 00:12:18
Write JSON - - Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

Write JSON -

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc
2020年04月02日
00:12:18 - 00:15:41
Read JSON - - Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

Read JSON -

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc
2020年04月02日
00:15:41 - 00:16:59
Write SQL - - Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

Write SQL -

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc
2020年04月02日
00:16:59 - 00:24:57
# Just in case:If you are using sqlite3 instead of sqlalchemy, you have to use SQL string not the table name: - Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

# Just in case:If you are using sqlite3 instead of sqlalchemy, you have to use SQL string not the table name:

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc
2020年04月02日
00:24:57 - 00:32:45
Read SQL -  (Start at 16:59 to see installed packages) - Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

Read SQL - (Start at 16:59 to see installed packages)

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc
2020年04月02日
00:24:57 - 00:32:45
.000 +0200 and i used format='%Y-%m-%d %H:%M:%S.%f %z'  It say format does not match. Where did I go wrong. What will the correct format be? Anyone? - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

.000 +0200 and i used format='%Y-%m-%d %H:%M:%S.%f %z' It say format does not match. Where did I go wrong. What will the correct format be? Anyone?

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:00:00 - 00:35:41
for the resampling of the whole DataFrame, say, if I want to get the open price at  for the 'open price' of the day and the close price at 23:00:00 for the 'close price' of the day, what function am I supposed to use here?Thank you ! - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

for the resampling of the whole DataFrame, say, if I want to get the open price at for the 'open price' of the day and the close price at 23:00:00 for the 'close price' of the day, what function am I supposed to use here?Thank you !

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:00:00 - 00:35:41
, can you please tell me how to convert this format to standard date and time format ?   I try this df['Datetime'] = pd.to_datetime(df['Datetime'], format='%m %d %Y %H:%M'), but it didn't work....  please help. - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

, can you please tell me how to convert this format to standard date and time format ? I try this df['Datetime'] = pd.to_datetime(df['Datetime'], format='%m %d %Y %H:%M'), but it didn't work.... please help.

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:00:02 - 00:35:41
convert to datetime using to_datetime - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

convert to datetime using to_datetime

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:03:50 - 00:07:45
Firstly at  , we converted all the values of the Series to datetime type from String type using:df[‘Date’] = pd.to_datetime(df[‘Date’], format = ‘%Y-%m-%d %I-%p’) - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

Firstly at , we converted all the values of the Series to datetime type from String type using:df[‘Date’] = pd.to_datetime(df[‘Date’], format = ‘%Y-%m-%d %I-%p’)

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:06:36 - 00:10:24
parse dates while loading data from csv - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

parse dates while loading data from csv

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:07:45 - 00:11:20
too complicated - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

too complicated

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:08:50 - 00:35:41
but when doing the same thing while loading csv ,we used a lengthier approach of using a lambda and assigning it to date_parser argument.So my doubt is whether while following the later approach, do we basically apply a function(lambda in this case) to a column('Date') so that the function is applied to each value in that column and it converts each value(String) by calling strptime() ?If so, can we assume to_datetime() method converts a whole Series to datetime type while the later approach converts each value of a Series to datetime object?Is there any way we can replicate the former way while loading the csv file? That look minimal and easy.Thanks in advence - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

but when doing the same thing while loading csv ,we used a lengthier approach of using a lambda and assigning it to date_parser argument.So my doubt is whether while following the later approach, do we basically apply a function(lambda in this case) to a column('Date') so that the function is applied to each value in that column and it converts each value(String) by calling strptime() ?If so, can we assume to_datetime() method converts a whole Series to datetime type while the later approach converts each value of a Series to datetime object?Is there any way we can replicate the former way while loading the csv file? That look minimal and easy.Thanks in advence

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:10:24 - 00:35:41
using day_name on whole series using dt class - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

using day_name on whole series using dt class

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:11:20 - 00:12:20
create column of dayname - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

create column of dayname

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:12:20 - 00:13:20
min and max methods on datetime series - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

min and max methods on datetime series

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:13:20 - 00:15:00
filtering by dates as string - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

filtering by dates as string

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:15:00 - 00:17:20
filter by to_datetime - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

filter by to_datetime

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:17:20 - 00:18:40
At  time, where you explain filtering the data on basis of start and end date, I tried doing that without changing the date string to datetime format of pandas and it still worked. What you suggested is this "filt=(df['Date']>=pandas.to_datetime('2019-01-01')) & (df['Date']<pandas.to_datetime('2020-01-01'))df.loc[filt]" what I did is filt=(df['Date']>='2019-01-01') & (df['Date']<'2020-01-01')df.loc[filt]. Could you please suggest if the way I did is wrong or will give me the correct results always or not? - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

At time, where you explain filtering the data on basis of start and end date, I tried doing that without changing the date string to datetime format of pandas and it still worked. What you suggested is this "filt=(df['Date']>=pandas.to_datetime('2019-01-01')) & (df['Date']<pandas.to_datetime('2020-01-01'))df.loc[filt]" what I did is filt=(df['Date']>='2019-01-01') & (df['Date']<'2020-01-01')df.loc[filt]. Could you please suggest if the way I did is wrong or will give me the correct results always or not?

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:18:20 - 00:35:41
set date as index - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

set date as index

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:18:40 - 00:19:21
filter data by just passing the date in brackets - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

filter data by just passing the date in brackets

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:19:21 - 00:20:05
Your tutorials are the bests on the web. Before I can do the index filter ( in the video), I had to sort the dataframe by index(df = df.sort_index()) I don't know why but it was given me an error (AssertionError: <class 'numpy.ndarray'>).Thanks for sharing. - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

Your tutorials are the bests on the web. Before I can do the index filter ( in the video), I had to sort the dataframe by index(df = df.sort_index()) I don't know why but it was given me an error (AssertionError: <class 'numpy.ndarray'>).Thanks for sharing.

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:19:35 - 00:35:41
@ df['2019'] does not work for me. Can anyone help me with this issue? ok nevermind i got it figured out. df.index = pd.to_datetime(df.index) then sort it by index if anyone run into the same issueGreat video btw! - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

@ df['2019'] does not work for me. Can anyone help me with this issue? ok nevermind i got it figured out. df.index = pd.to_datetime(df.index) then sort it by index if anyone run into the same issueGreat video btw!

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:20:00 - 00:35:41
using a slice to get specific dates data - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

using a slice to get specific dates data

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:20:05 - 00:21:00
Hi all, In minute  when filtering df['2020-01':'2020-02] I get an empty dataframe as result. However, if I change the order of the filter df['2020-02':'2020-01] it works. Is there something wrong with this? I didn't sort in any way different than Corey's video but it seems that I need to filter following the pattern of the index to get the correct result. Any comments? Thanks! (Ricardo from Argentina) - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

Hi all, In minute when filtering df['2020-01':'2020-02] I get an empty dataframe as result. However, if I change the order of the filter df['2020-02':'2020-01] it works. Is there something wrong with this? I didn't sort in any way different than Corey's video but it seems that I need to filter following the pattern of the index to get the correct result. Any comments? Thanks! (Ricardo from Argentina)

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:20:30 - 00:35:41
calculating average of a slice(timeframe) - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

calculating average of a slice(timeframe)

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:21:00 - 00:22:05
getting max value of a column on a given day - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

getting max value of a column on a given day

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:22:05 - 00:23:50
df['only_time'] = ''how can i do it without external loop code, because loop taking long time to apply.Thanks for your help. - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

df['only_time'] = ''how can i do it without external loop code, because loop taking long time to apply.Thanks for your help.

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:23:00 - 00:35:41
resampling(breaking down by days) a whole column into a new variable - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

resampling(breaking down by days) a whole column into a new variable

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:23:50 - 00:27:00
plotting with matplotlib in pandas - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

plotting with matplotlib in pandas

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:27:00 - 00:28:28
resampling df with multiple columns - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

resampling df with multiple columns

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:28:28 - 00:30:55
using agg to apply different function on different columns while resampling - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

using agg to apply different function on different columns while resampling

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:30:55 - 00:35:41
You could have also used method 'first' for open price within agg functionThanks a lot for these videos. - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

You could have also used method 'first' for open price within agg functionThanks a lot for these videos.

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:32:28 - 00:35:41
I got this error 'DataFrame' object has no attribute 'resamlpe' - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

I got this error 'DataFrame' object has no attribute 'resamlpe'

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:32:35 - 00:35:41
did the plotting series of tutorials ever come? - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

did the plotting series of tutorials ever come?

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:32:58 - 00:35:41
the date is same but the time is changing. when i am plotting the graph with this column on x axis it shows 17.07 00..... 17.07 04 i know that at end 00, 04 is the time but i wnt on x axis only time and the dstype of this column is datetime64ns. Can any one help me - Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

the date is same but the time is changing. when i am plotting the graph with this column on x axis it shows 17.07 00..... 17.07 04 i know that at end 00, 04 is the time but i wnt on x axis only time and the dstype of this column is datetime64ns. Can any one help me

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data
2020年03月18日
00:35:20 - 00:35:41
when she talks with me xdd - Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values

when she talks with me xdd

Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values
2020年02月24日
00:07:20 - 00:31:54
we can use    df.replace(['NA', 'Missing'], np.nan, inplace=True)     instead - Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values

we can use df.replace(['NA', 'Missing'], np.nan, inplace=True) instead

Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values
2020年02月24日
00:11:36 - 00:31:54
watch from  time stamp, Thank me later XD - Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values

watch from time stamp, Thank me later XD

Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values
2020年02月24日
00:17:00 - 00:31:54
Question @.So he's saying you can't convert a Nonetype to an int but you can convert a Nonetype to a float? I'm confused here. Can someone please clear this up for me? I didn't really understand Corey's explanation. - Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values

Question @.So he's saying you can't convert a Nonetype to an int but you can convert a Nonetype to a float? I'm confused here. Can someone please clear this up for me? I didn't really understand Corey's explanation.

Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values
2020年02月24日
00:17:51 - 00:31:54
I mean if you're coding for more than 50 years, you probably just started as soon as computers fucking came out lol😂😂😂 - Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values

I mean if you're coding for more than 50 years, you probably just started as soon as computers fucking came out lol😂😂😂

Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values
2020年02月24日
00:26:03 - 00:31:54
In  of the video. For a one liner code. df['YearsCode'].replace(['Less than 1 year','More than 50 years'],[0,51]), inplace=True). Correct me if I'm wrong I'm new to Python. But great video again Corey! Hats off! - Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values

In of the video. For a one liner code. df['YearsCode'].replace(['Less than 1 year','More than 50 years'],[0,51]), inplace=True). Correct me if I'm wrong I'm new to Python. But great video again Corey! Hats off!

Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values
2020年02月24日
00:27:28 - 00:31:54
Intro: - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Intro:

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:00:00 - 00:00:56
Recap: - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Recap:

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:00:56 - 00:01:16
Basic Aggregate Functions:  (`df['col'].mean()`, `df['col'].median()`, `df['col'].mode()`, `df['col'].describe()`, `df.describe()`)- `describe` gives count (# non-NaN rows), mean, std, min, max, and 25%, 50%, and 75% quantiles - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Basic Aggregate Functions: (`df['col'].mean()`, `df['col'].median()`, `df['col'].mode()`, `df['col'].describe()`, `df.describe()`)- `describe` gives count (# non-NaN rows), mean, std, min, max, and 25%, 50%, and 75% quantiles

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:01:16 - 00:12:00
Aggregate Column - - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Aggregate Column -

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:02:00 - 00:03:55
median function - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

median function

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:03:10 - 00:05:00
Aggregate DataFrame - - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Aggregate DataFrame -

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:03:55 - 00:07:51
describe function - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

describe function

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:05:00 - 00:07:20
count() - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

count()

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:07:20 - 00:08:05
Value Counts - - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Value Counts -

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:07:51 - 00:12:30
value_counts() - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

value_counts()

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:08:05 - 00:12:51
if you have to do that to a specific country e.g. UK, how many people hobyist from UK and how many are not, how do you do that? - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

if you have to do that to a specific country e.g. UK, how many people hobyist from UK and how many are not, how do you do that?

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:09:08 - 00:49:06
Counts by Percentage:  (`df['col'].value_counts(normalize=True)`) - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Counts by Percentage: (`df['col'].value_counts(normalize=True)`)

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:12:00 - 00:12:32
value count in % - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

value count in %

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:12:05 - 00:49:06
Grouping - - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Grouping -

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:12:30 - 00:26:00
Intro to Groupby:- split object, apply function, combine results - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Intro to Groupby:- split object, apply function, combine results

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:12:32 - 00:13:38
grouping the data - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

grouping the data

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:12:51 - 00:14:39
Split:df.groupby(['col'])df.get_group(['col_val']) - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Split:df.groupby(['col'])df.get_group(['col_val'])

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:13:38 - 00:18:23
groupby() function - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

groupby() function

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:14:39 - 00:16:07
get_group(), grabbing a specific group by name - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

get_group(), grabbing a specific group by name

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:16:07 - 00:17:30
doing same by using the filters - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

doing same by using the filters

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:17:30 - 00:18:40
Apply Function & Combine:.agg(['mean', 'median']) - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Apply Function & Combine:.agg(['mean', 'median'])

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:18:23 - 00:27:02
using value_counts on filters - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

using value_counts on filters

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:18:40 - 00:20:20
at , using .loc u got 20,00 rows and using group by u got 9,000 rows, how?? - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

at , using .loc u got 20,00 rows and using group by u got 9,000 rows, how??

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:19:00 - 00:49:06
Small note: at , the more correct syntax would be to select your column within the .loc method: df.loc[filt, 'SocialMedia'].value_counts(). - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Small note: at , the more correct syntax would be to select your column within the .loc method: df.loc[filt, 'SocialMedia'].value_counts().

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:19:06 - 00:49:06
@ How are you able to put the two brackets side-by-side in the line: df.loc[filt]['socialmedia'].value_counts()I dont get why it works with df.loc, but when I tried to set a variable "group" to the groupby function, it doesnt work? - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

@ How are you able to put the two brackets side-by-side in the line: df.loc[filt]['socialmedia'].value_counts()I dont get why it works with df.loc, but when I tried to set a variable "group" to the groupby function, it doesnt work?

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:19:15 - 00:49:06
value_counts() for groups - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

value_counts() for groups

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:20:20 - 00:21:49
@ How would return just the top row for each country?I want it to look something like this...Country           Social MediaAfghanistan    Facebook         15Zimbabwe       Facebook          3 - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

@ How would return just the top row for each country?I want it to look something like this...Country Social MediaAfghanistan Facebook 15Zimbabwe Facebook 3

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:21:46 - 00:49:06
using loc to find for one country - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

using loc to find for one country

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:21:49 - 00:23:40
Corey, at  the groupby object forms a series with multindex. I'll try later to use pivot_table() to make index the countries and the columns representing different social apps. Although it won't be tidy data, I think it will be useful to explore it. - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Corey, at the groupby object forms a series with multindex. I'll try later to use pivot_table() to make index the countries and the columns representing different social apps. Although it won't be tidy data, I think it will be useful to explore it.

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:21:50 - 00:49:06
percentage by using normalize - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

percentage by using normalize

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:23:40 - 00:25:00
median by country group - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

median by country group

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:25:00 - 00:26:13
Multiple Aggregates on Group - - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Multiple Aggregates on Group -

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:26:00 - 00:27:20
agg function for multiple functions - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

agg function for multiple functions

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:26:13 - 00:27:30
Gotchas:.apply() on SeriesGroup - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Gotchas:.apply() on SeriesGroup

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:27:02 - 00:33:36
People Who Know Python By Country - - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

People Who Know Python By Country -

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:27:20 - 00:34:20
using filtering to get python users by country - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

using filtering to get python users by country

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:27:30 - 00:30:20
At  in the video, would the following statement be more accurate as we want to know how many people know Python in Indiafilt = df['Country']=='India'df[filt]['LanguageWorkedWith'].str.contains('Python').count() - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

At in the video, would the following statement be more accurate as we want to know how many people know Python in Indiafilt = df['Country']=='India'df[filt]['LanguageWorkedWith'].str.contains('Python').count()

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:30:07 - 00:49:06
error on using same approach for groups - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

error on using same approach for groups

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:30:20 - 00:31:40
apply method to run that on group - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

apply method to run that on group

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:31:40 - 00:35:40
Hi Corey. in the group by method in , in the apply() method, the x in the lambda represent the series? in the apply method in the previous lectures isn't the apply method use in every cell/value in a series? Not in the series itself just like the 32:58? I'm new to python.  Thanks! - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Hi Corey. in the group by method in , in the apply() method, the x in the lambda represent the series? in the apply method in the previous lectures isn't the apply method use in every cell/value in a series? Not in the series itself just like the 32:58? I'm new to python. Thanks!

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:32:58 - 00:49:06
Very interesting tutorial. Thumb up! Particularly at  !! - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Very interesting tutorial. Thumb up! Particularly at !!

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:33:30 - 00:49:06
Real-World Problem (Calculation from Several Groups):- What percentage of people from each country know Python?country_respondents = df['Country'].value_counts()country_uses_python = country_grp['LanguageWorkedWith'].apply(lambda x: x.str.contains('Python').sum())result = pd.concat([country_respondents, country_uses_python], axis='columns')result.rename(columns={'Country': 'NumRespondents', 'LanguageWorkedWith': 'NumKnowsPython'})result['PctKnowsPython'] = country_uses_python / country_uses_python * 100result.sort_values(by='PctKnowsPython', ascending=False)result.loc['Japan'] - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Real-World Problem (Calculation from Several Groups):- What percentage of people from each country know Python?country_respondents = df['Country'].value_counts()country_uses_python = country_grp['LanguageWorkedWith'].apply(lambda x: x.str.contains('Python').sum())result = pd.concat([country_respondents, country_uses_python], axis='columns')result.rename(columns={'Country': 'NumRespondents', 'LanguageWorkedWith': 'NumKnowsPython'})result['PctKnowsPython'] = country_uses_python / country_uses_python * 100result.sort_values(by='PctKnowsPython', ascending=False)result.loc['Japan']

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:33:36 - 00:45:23
#Ques at , what percentage of people from each country know Python? - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

#Ques at , what percentage of people from each country know Python?

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:34:20 - 00:49:06
Practice Question - - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Practice Question -

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:34:20 - 00:37:27
Possible solutions for the question atcountry_grp['LanguageWorkedWith'].apply(lambda series: series.str.contains('Python').sum()/len(series)) - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Possible solutions for the question atcountry_grp['LanguageWorkedWith'].apply(lambda series: series.str.contains('Python').sum()/len(series))

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:34:28 - 00:49:06
try this as the solution to question asked by respected Corey sir at  :l_countries = pd.unique(csv.dropna()['Country'])a = [(i, ((gbo.get_group(i)['LanguageWorkedWith'].str.contains('Python').sum()) / (gbo.get_group(i)['LanguageWorkedWith'].count()) * 100)) for i in l_countries] - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

try this as the solution to question asked by respected Corey sir at :l_countries = pd.unique(csv.dropna()['Country'])a = [(i, ((gbo.get_group(i)['LanguageWorkedWith'].str.contains('Python').sum()) / (gbo.get_group(i)['LanguageWorkedWith'].count()) * 100)) for i in l_countries]

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:34:35 - 00:49:06
I was just wondering if on  you could have just modified the lambda expression so it could just do all the calculations in place like so:country_grp["LanguageWorkedWith"].apply(lambda country_ser: (country_ser.str.contains("Python").sum()*/country_ser.value_counts().sum())*100)What I tried to do was to count the sum of total respondents for each country and do all the necessary calculations inside the lambda,  and, though the result that I got were similar to yours, they still were slightly different. - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

I was just wondering if on you could have just modified the lambda expression so it could just do all the calculations in place like so:country_grp["LanguageWorkedWith"].apply(lambda country_ser: (country_ser.str.contains("Python").sum()*/country_ser.value_counts().sum())*100)What I tried to do was to count the sum of total respondents for each country and do all the necessary calculations inside the lambda, and, though the result that I got were similar to yours, they still were slightly different.

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:35:38 - 00:49:06
At  since you want to get the percentage of boolean values that are 1 you can pretty much just replace .sum() with .mean(). It's sum/length. - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

At since you want to get the percentage of boolean values that are 1 you can pretty much just replace .sum() with .mean(). It's sum/length.

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:35:40 - 00:49:06
finding the percentage of people using python in each country(group) - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

finding the percentage of people using python in each country(group)

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:35:40 - 00:37:40
. I don’t have the data or code to run to see if this would work right now, but at first glance I’d run:.apply(lambda x: x.str.contains(‘Python’).mean()) - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

. I don’t have the data or code to run to see if this would work right now, but at first glance I’d run:.apply(lambda x: x.str.contains(‘Python’).mean())

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:35:55 - 00:49:06
I just wanted to share something regarding LanguagesHaveWorked grouped by Country (on ). I think the below code is rather simpler if we just wanna look at the percentages only, but I don't how reliable this method might be - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

I just wanted to share something regarding LanguagesHaveWorked grouped by Country (on ). I think the below code is rather simpler if we just wanna look at the percentages only, but I don't how reliable this method might be

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:36:00 - 00:49:06
() I added just a short method to get percentage of python users.country_grp['LanguageWorkedWith'].apply(lambda x: x.str.contains('Python').sum())->country_grp['LanguageWorkedWith'].apply(lambda x: (x.str.contains('Python').sum())/x.count()) - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

() I added just a short method to get percentage of python users.country_grp['LanguageWorkedWith'].apply(lambda x: x.str.contains('Python').sum())->country_grp['LanguageWorkedWith'].apply(lambda x: (x.str.contains('Python').sum())/x.count())

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:36:18 - 00:49:06
Concat Series - - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Concat Series -

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:37:27 - 00:49:06
using concat for combining series in a dataframe - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

using concat for combining series in a dataframe

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:37:40 - 00:45:30
-  U S A ! U S A ! U S A ! - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

- U S A ! U S A ! U S A !

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:44:30 - 00:49:06
Outro: - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Outro:

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:45:23 - 00:49:06
adding percentage column - Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

adding percentage column

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data
2020年02月14日
00:45:30 - 00:49:06