title
Python Pandas Tutorial (Part 5): Updating Rows and Columns - Modifying Data Within DataFrames
description
In this video, we will be learning how to update the values in our rows and columns.
This video is sponsored by Brilliant. Go to https://brilliant.org/cms to sign up for free. Be one of the first 200 people to sign up with this link and get 20% off your premium subscription.
In this Python Programming video, we will be learning how to modify the data within our DataFrames. We will use some of the filtering techniques we learned in the last video to update values conditionally, and we will also be learning how to use the apply, map, and applymap method. Let's get started...
The code for this video can be found at:
http://bit.ly/Pandas-05
StackOverflow Survey Download Page - http://bit.ly/SO-Survey-Download
✅ 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 #Pandas
detail
{'title': 'Python Pandas Tutorial (Part 5): Updating Rows and Columns - Modifying Data Within DataFrames', 'heatmap': [{'end': 1085.799, 'start': 1056.722, 'weight': 1}, {'end': 1540.611, 'start': 1513.331, 'weight': 0.719}, {'end': 1590.904, 'start': 1558.823, 'weight': 0.783}, {'end': 1706.824, 'start': 1653.696, 'weight': 0.893}, {'end': 1841.606, 'start': 1775.152, 'weight': 0.735}], 'summary': 'Tutorial on python pandas covers altering rows and columns in data frames, modifying column names, updating data in rows and columns, single value modification, apply method, map method, and using the replace method. it includes examples and emphasizes the importance of indexers for efficient data manipulation, also mentioning sponsorship by brilliant.org.', 'chapters': [{'end': 70.008, 'segs': [{'end': 70.008, 'src': 'embed', 'start': 0.169, 'weight': 0, 'content': [{'end': 5.834, 'text': "Hey there, how's it going everybody? In this video, we're going to be learning how to alter existing rows and columns in our data frames.", 'start': 0.169, 'duration': 5.665}, {'end': 12.64, 'text': 'So in the last video, we learned how to filter out specific information, and we can use those techniques here to also modify our data.', 'start': 6.154, 'duration': 6.486}, {'end': 16.583, 'text': "So we'll learn how to update the data for our rows and our columns,", 'start': 13.04, 'duration': 3.543}, {'end': 21.927, 'text': "and in the next video We'll also learn how to add and remove rows and columns from our data frames.", 'start': 16.583, 'duration': 5.344}, {'end': 26.87, 'text': "Now I'd like to mention that we do have a sponsor for this series of videos, and that is Brilliant.org.", 'start': 22.347, 'duration': 4.523}, {'end': 34.515, 'text': 'So I really want to thank Brilliant for sponsoring this series and it would be great if you all could check them out using the link in the description section below and support the sponsors.', 'start': 27.21, 'duration': 7.305}, {'end': 36.956, 'text': "And I'll talk more about their services in just a bit.", 'start': 34.875, 'duration': 2.081}, {'end': 39.077, 'text': "So with that said, let's go ahead and get started.", 'start': 37.316, 'duration': 1.761}, {'end': 43.859, 'text': "Okay, so let's look at how to update data within our rows and columns.", 'start': 39.477, 'duration': 4.382}, {'end': 47.641, 'text': "The last couple of videos, we've already seen how we can filter specific data.", 'start': 44.299, 'duration': 3.342}, {'end': 52.963, 'text': "But now let's take a look at those same concepts and use them to make changes to our data.", 'start': 48.101, 'duration': 4.862}, {'end': 57.445, 'text': "So let's look at updating columns first, and then we'll update some rows.", 'start': 53.363, 'duration': 4.082}, {'end': 61.706, 'text': "So I currently have my snippets file open here that we've seen in previous videos,", 'start': 57.885, 'duration': 3.821}, {'end': 70.008, 'text': 'so that we can see what this looks like on a smaller data set before seeing how to do this on our larger data set with that Stack Overflow survey data.', 'start': 61.706, 'duration': 8.302}], 'summary': 'Learning to alter rows and columns in data frames, sponsored by brilliant.org.', 'duration': 69.839, 'max_score': 0.169, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE169.jpg'}], 'start': 0.169, 'title': 'Data frame alteration tutorial', 'summary': 'Covers altering existing rows and columns in data frames, including updating data and adding/removing rows and columns. it also mentions sponsorship by brilliant.org.', 'chapters': [{'end': 70.008, 'start': 0.169, 'title': 'Data frame alteration tutorial', 'summary': 'Covers learning how to alter existing rows and columns in data frames, including updating data for rows and columns and adding/removing rows and columns. it also mentions sponsorship by brilliant.org.', 'duration': 69.839, 'highlights': ['The chapter covers learning how to alter existing rows and columns in data frames, including updating data for rows and columns and adding/removing rows and columns.', 'It mentions sponsorship by Brilliant.org for the series of videos, inviting viewers to check them out using the link in the description section below.', 'The video will also teach how to add and remove rows and columns from data frames.', 'The chapter demonstrates using techniques to make changes to the data based on concepts previously learned.', 'The tutorial is accompanied by a snippets file for demonstration purposes.']}], 'duration': 69.839, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE169.jpg', 'highlights': ['The chapter covers learning how to alter existing rows and columns in data frames, including updating data for rows and columns and adding/removing rows and columns.', 'The video will also teach how to add and remove rows and columns from data frames.', 'The chapter demonstrates using techniques to make changes to the data based on concepts previously learned.', 'The tutorial is accompanied by a snippets file for demonstration purposes.', 'It mentions sponsorship by Brilliant.org for the series of videos, inviting viewers to check them out using the link in the description section below.']}, {'end': 569.227, 'segs': [{'end': 118.71, 'src': 'embed', 'start': 91.701, 'weight': 0, 'content': [{'end': 95.084, 'text': "So let's say that we wanted to update the columns to be a little more specific.", 'start': 91.701, 'duration': 3.383}, {'end': 98.728, 'text': "So let's say that I wanted this to be first name instead of first.", 'start': 95.485, 'duration': 3.243}, {'end': 100.87, 'text': "So there's a couple of ways that we can do this.", 'start': 99.188, 'duration': 1.682}, {'end': 108.339, 'text': 'So first, if we want to rename all of the columns, then we can simply do an assignment using the columns attribute that I just used.', 'start': 101.391, 'duration': 6.948}, {'end': 114.146, 'text': 'So in order to do this, I could just use an assignment here and just pass in a list.', 'start': 108.659, 'duration': 5.487}, {'end': 118.71, 'text': 'So I could just pass in a list of all the different columns that I want these to be.', 'start': 114.626, 'duration': 4.084}], 'summary': 'To update columns, use assignment with the columns attribute and pass in a list of the desired names.', 'duration': 27.009, 'max_score': 91.701, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE91701.jpg'}, {'end': 202.624, 'src': 'embed', 'start': 170.393, 'weight': 2, 'content': [{'end': 174.974, 'text': "So for example, let's say that I wanted to uppercase all of the column names here.", 'start': 170.393, 'duration': 4.581}, {'end': 186.771, 'text': "So in order to do this, I could use a list comprehension and I could just say DF columns is equal to and now we'll just say like X dot upper.", 'start': 175.475, 'duration': 11.296}, {'end': 191.54, 'text': '4x in df dot columns.', 'start': 188.379, 'duration': 3.161}, {'end': 202.624, 'text': 'so if i print out that data frame after making that change, then we can see that now all of our column names have been translated to uppercase.', 'start': 191.54, 'duration': 11.084}], 'summary': 'Uppercased all column names using list comprehension, resulting in all names being translated to uppercase.', 'duration': 32.231, 'max_score': 170.393, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE170393.jpg'}, {'end': 249.925, 'src': 'embed', 'start': 225.013, 'weight': 3, 'content': [{'end': 234.317, 'text': 'then what you could do is just do something similar here and say df columns is equal to df.columns.str.', 'start': 225.013, 'duration': 9.304}, {'end': 243.382, 'text': "we're using the str method on this columns series here and then we can use the replace method from that string class.", 'start': 234.317, 'duration': 9.065}, {'end': 249.925, 'text': 'so I can just pass in a space and say that we want to replace all those spaces with underscores.', 'start': 243.382, 'duration': 6.543}], 'summary': 'Use df.columns.str.replace to replace spaces with underscores.', 'duration': 24.912, 'max_score': 225.013, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE225013.jpg'}, {'end': 316.301, 'src': 'embed', 'start': 291.59, 'weight': 1, 'content': [{'end': 298.212, 'text': 'well, in this case we can use the rename method and just pass in a dictionary of the columns that we want to change.', 'start': 291.59, 'duration': 6.622}, {'end': 307.415, 'text': 'so if I want to set the first name and last name back to what they were before, then I could say DF dot, rename.', 'start': 298.212, 'duration': 9.203}, {'end': 313.459, 'text': "and now we can just pass in the columns and we're going to pass in a dictionary of what we want here.", 'start': 307.415, 'duration': 6.044}, {'end': 316.301, 'text': 'so the key is going to be the old value.', 'start': 313.459, 'duration': 2.842}], 'summary': 'Using the rename method to change column names in a dataframe.', 'duration': 24.711, 'max_score': 291.59, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE291590.jpg'}, {'end': 409.326, 'src': 'embed', 'start': 381.067, 'weight': 5, 'content': [{'end': 384.771, 'text': "so first let's look at how to update a single value now.", 'start': 381.067, 'duration': 3.704}, {'end': 393.84, 'text': "in the previous video we saw how we can look up values using loc and iloc, and we'll use that as our starting point for setting values as well.", 'start': 384.771, 'duration': 9.069}, {'end': 399.304, 'text': "so let's grab the row for john doe Right here it's row number two.", 'start': 393.84, 'duration': 5.464}, {'end': 403.345, 'text': "Let's grab that row and change his last name to Smith.", 'start': 400.004, 'duration': 3.341}, {'end': 409.326, 'text': 'So in order to grab that row, we can simply grab that row with the index label two.', 'start': 403.765, 'duration': 5.561}], 'summary': "Demonstrating how to update a single value using loc and iloc, changing john doe's last name to smith.", 'duration': 28.259, 'max_score': 381.067, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE381067.jpg'}, {'end': 504.78, 'src': 'embed', 'start': 480.802, 'weight': 4, 'content': [{'end': 489.809, 'text': 'so it would be a pain if we wanted to change a single row and we had to pass in or a single column and we had to pass in this huge list of 85 different values.', 'start': 480.802, 'duration': 9.007}, {'end': 494.432, 'text': 'That would really suck to need to pass in that entire list just to change those couple of values.', 'start': 490.049, 'duration': 4.383}, {'end': 499.536, 'text': 'So in this case, we can just specify the exact columns using loc.', 'start': 494.832, 'duration': 4.704}, {'end': 504.78, 'text': 'And again, we saw this before when learning how to use the loc to filter data.', 'start': 499.936, 'duration': 4.844}], 'summary': 'Using loc to specify exact columns, avoiding need to pass huge lists of values.', 'duration': 23.978, 'max_score': 480.802, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE480802.jpg'}], 'start': 70.528, 'title': 'Modifying and updating data frame columns', 'summary': 'Demonstrates modifying data frame columns including renaming all columns, using list comprehension to change column names to uppercase, and replacing spaces with underscores, with examples and quantifiable data. it also covers updating columns and rows, explaining how to replace all columns, use the rename method to change specific columns, and update data in rows using loc and iloc, including setting values and specifying specific columns to change.', 'chapters': [{'end': 270.317, 'start': 70.528, 'title': 'Modifying data frame columns', 'summary': 'Demonstrates how to modify data frame columns, including renaming all columns, using list comprehension to change column names to uppercase, and replacing spaces with underscores, with examples and quantifiable data.', 'duration': 199.789, 'highlights': ['The chapter demonstrates renaming all columns by using the columns attribute and passing in a list of new column names, such as first name, last name, and keeping email the same.', 'Using list comprehension, the chapter shows how to change all column names to uppercase letters by applying the upper() function to each column name.', 'The chapter illustrates how to replace spaces with underscores in column names using the str method and the replace method from the string class, ensuring correct syntax for accessing column names.']}, {'end': 569.227, 'start': 270.698, 'title': 'Updating columns and rows', 'summary': 'Covers updating columns and rows in a dataframe, explaining how to replace all columns, use the rename method to change specific columns, and update data in rows using loc and iloc, including setting values and specifying specific columns to change.', 'duration': 298.529, 'highlights': ['The chapter covers updating columns and rows in a dataframe, explaining how to replace all columns, use the rename method to change specific columns, and update data in rows using loc and iloc, including setting values and specifying specific columns to change.', "The method to update columns involves using the rename method and passing in a dictionary of the columns to be changed, with the need to set 'in place' to true to make the change go through.", 'Updating data in rows involves using loc and iloc to grab specific rows and then setting values by passing in all the new values for the row or specifying the exact columns to be changed using loc.']}], 'duration': 498.699, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE70528.jpg', 'highlights': ['The chapter demonstrates renaming all columns by using the columns attribute and passing in a list of new column names, such as first name, last name, and keeping email the same.', "The method to update columns involves using the rename method and passing in a dictionary of the columns to be changed, with the need to set 'in place' to true to make the change go through.", 'Using list comprehension, the chapter shows how to change all column names to uppercase letters by applying the upper() function to each column name.', 'The chapter illustrates how to replace spaces with underscores in column names using the str method and the replace method from the string class, ensuring correct syntax for accessing column names.', 'Updating data in rows involves using loc and iloc to grab specific rows and then setting values by passing in all the new values for the row or specifying the exact columns to be changed using loc.', 'The chapter covers updating columns and rows in a dataframe, explaining how to replace all columns, use the rename method to change specific columns, and update data in rows using loc and iloc, including setting values and specifying specific columns to change.']}, {'end': 775.996, 'segs': [{'end': 732.561, 'src': 'embed', 'start': 592.531, 'weight': 0, 'content': [{'end': 598.918, 'text': "Now I'm just saying that I want row two, the column of last, and we'll just set that equal to Smith.", 'start': 592.531, 'duration': 6.387}, {'end': 602.822, 'text': 'Whoops, let me put that in the string there.', 'start': 599.298, 'duration': 3.524}, {'end': 608.669, 'text': 'So if I run that, then we look at our data frame, then we can see that it only changed that one value.', 'start': 603.243, 'duration': 5.426}, {'end': 611.512, 'text': 'Now pandas does have another indexer called at.', 'start': 609.029, 'duration': 2.483}, {'end': 617.078, 'text': 'And this is specifically meant for changing or looking up a single value.', 'start': 612.593, 'duration': 4.485}, {'end': 623.825, 'text': 'Now, honestly, I just use .loc from these most of the time, but the option is there if you want it.', 'start': 617.478, 'duration': 6.347}, {'end': 626.407, 'text': "I'm assuming it's there for performance reasons.", 'start': 624.345, 'duration': 2.062}, {'end': 634.595, 'text': 'So if I wanted to change this back, since this is just a single value, then instead of using .loc, then I could also use .at.', 'start': 627.228, 'duration': 7.367}, {'end': 640.36, 'text': "So I'll do this exact same assignment here and I'll change this back to Doe.", 'start': 636.477, 'duration': 3.883}, {'end': 645.703, 'text': "But instead of .loc I'm going to say .at and let's just set that back.", 'start': 640.74, 'duration': 4.963}, {'end': 649.325, 'text': 'And then if I look at the data frame then we can see that that worked as well.', 'start': 646.323, 'duration': 3.002}, {'end': 652.107, 'text': "And I'll be honest here I'll have to look at the documentation.", 'start': 649.786, 'duration': 2.321}, {'end': 659.412, 'text': "I'm not really sure why we would use .at instead of .loc when we only need to get or set a single value.", 'start': 652.527, 'duration': 6.885}, {'end': 661.293, 'text': "Maybe it's for performance reasons.", 'start': 659.452, 'duration': 1.841}, {'end': 666.036, 'text': 'But I personally find myself using loc and iloc even for single values.', 'start': 662.013, 'duration': 4.023}, {'end': 673.702, 'text': "I actually did look it up in the pandas documentation, but all it says there is that it's there and that it's similar to .loc.", 'start': 666.657, 'duration': 7.045}, {'end': 677.425, 'text': "It doesn't provide any actual justification as to why we'd use it.", 'start': 674.022, 'duration': 3.403}, {'end': 684.009, 'text': "But I wanted you to know that it's available since it's obviously there for a reason and hasn't been deprecated yet.", 'start': 678.065, 'duration': 5.944}, {'end': 688.871, 'text': 'Okay, so now let me show you one mistake that is very common.', 'start': 684.549, 'duration': 4.322}, {'end': 696.976, 'text': 'And that is when people try to change a value without using one of these indexers, without using .loc or .at.', 'start': 689.352, 'duration': 7.624}, {'end': 700.718, 'text': 'So let me show you what this error or this warning would look like.', 'start': 697.436, 'duration': 3.282}, {'end': 708.044, 'text': "So let's say that we have a large data frame where we want to find this John Doe person and change their last name to Smith.", 'start': 701.218, 'duration': 6.826}, {'end': 713.067, 'text': 'So one way that we could do this is to use a filter to grab that specific row.', 'start': 708.504, 'duration': 4.563}, {'end': 730, 'text': "So I will come down here to the bottom and I'll just create a filter here and I will say that the email column of the data frame equals equals john doe at email.com.", 'start': 713.588, 'duration': 16.412}, {'end': 732.561, 'text': "that is the filter that we're looking for.", 'start': 730, 'duration': 2.561}], 'summary': 'The transcript discusses using .loc and .at indexers in pandas for changing or looking up single values in a data frame.', 'duration': 140.03, 'max_score': 592.531, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE592531.jpg'}], 'start': 569.227, 'title': 'Pandas single value modification and .at method', 'summary': 'Demonstrates modifying a single value in a pandas data frame using .loc and .at indexers, highlighting the efficiency and common mistakes when changing values, emphasizing the importance of indexers for efficient data manipulation.', 'chapters': [{'end': 640.36, 'start': 569.227, 'title': 'Pandas single value modification', 'summary': 'Demonstrates how to modify a single value in a pandas data frame using .loc and .at indexers, highlighting the ability to change specific cells without the need for passing lists, and the performance difference between the two methods.', 'duration': 71.133, 'highlights': ['The chapter explains how to modify a single value in a Pandas data frame by passing in a single row and a single column, rather than a list, demonstrating the ability to change specific cells without the need for passing lists.', 'The chapter introduces the .loc indexer in Pandas, showcasing its usage for changing or looking up a single value within a data frame.', 'The chapter mentions the .at indexer as an alternative to .loc for changing single values, noting that .loc is primarily used and the existence of .at is assumed to be for performance reasons.']}, {'end': 775.996, 'start': 640.74, 'title': 'Pandas .at method and common mistakes', 'summary': 'Discusses the use of .at method in pandas for getting or setting a single value, along with common mistakes when changing values without using .loc or .at, emphasizing the importance of indexers for efficient data manipulation.', 'duration': 135.256, 'highlights': ['The chapter discusses the use of .at method in Pandas for getting or setting a single value, emphasizing its potential performance benefits.', 'It highlights the common mistake of trying to change a value in a data frame without using .loc or .at indexers, showcasing the potential error or warning that may occur.', 'The speaker demonstrates the process of using a filter to grab a specific row in a large data frame, showcasing the correct application of indexers for efficient data manipulation.']}], 'duration': 206.769, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE569227.jpg', 'highlights': ['The chapter explains how to modify a single value in a Pandas data frame by passing in a single row and a single column, rather than a list, demonstrating the ability to change specific cells without the need for passing lists.', 'The chapter introduces the .loc indexer in Pandas, showcasing its usage for changing or looking up a single value within a data frame.', 'The chapter discusses the use of .at method in Pandas for getting or setting a single value, emphasizing its potential performance benefits.', 'The speaker demonstrates the process of using a filter to grab a specific row in a large data frame, showcasing the correct application of indexers for efficient data manipulation.', 'It highlights the common mistake of trying to change a value in a data frame without using .loc or .at indexers, showcasing the potential error or warning that may occur.', 'The chapter mentions the .at indexer as an alternative to .loc for changing single values, noting that .loc is primarily used and the existence of .at is assumed to be for performance reasons.']}, {'end': 1408.245, 'segs': [{'end': 887.965, 'src': 'embed', 'start': 843.622, 'weight': 0, 'content': [{'end': 853.387, 'text': 'So Pandas does a lot better job of explaining this specific warning and they have a little link here down to the documentation directly within the warning itself.', 'start': 843.622, 'duration': 9.765}, {'end': 860.531, 'text': 'So if you want to learn more about this, then you can just click on that warning or go to this link and it explains it in a lot more detail.', 'start': 853.787, 'duration': 6.744}, {'end': 864.433, 'text': "But the moral of the story here is that when you're setting values,", 'start': 860.951, 'duration': 3.482}, {'end': 870.016, 'text': "just use loc or the at indexers that we've already seen and you shouldn't have any problems.", 'start': 864.433, 'duration': 5.583}, {'end': 875.098, 'text': 'So we could rerun this same operation up here at the top.', 'start': 870.396, 'duration': 4.702}, {'end': 883.262, 'text': "And actually, let me just copy this so that if anybody, I will put this notebook out here after I'm done with this.", 'start': 875.318, 'duration': 7.944}, {'end': 887.965, 'text': 'And if people want to see this exact error, then I will leave that cell there.', 'start': 883.623, 'duration': 4.342}], 'summary': 'Pandas provides detailed documentation within warnings, recommending the use of loc or at indexers to avoid problems.', 'duration': 44.343, 'max_score': 843.622, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE843622.jpg'}, {'end': 1035.785, 'src': 'embed', 'start': 1010.089, 'weight': 2, 'content': [{'end': 1019.494, 'text': 'So what I could do here is I could just say, df email is equal to df email dot string dot lowercase.', 'start': 1010.089, 'duration': 9.405}, {'end': 1029.18, 'text': 'So if I run this and then we look at our data frame, now those changes actually did go through and all of our emails are now lowercase.', 'start': 1020.014, 'duration': 9.166}, {'end': 1032.502, 'text': "So that's one way that we can change multiple rows at once.", 'start': 1029.7, 'duration': 2.802}, {'end': 1035.785, 'text': 'But maybe we want to do something a little more advanced.', 'start': 1032.983, 'duration': 2.802}], 'summary': 'Using df email = df email.string.lowercase, all emails in the data frame were converted to lowercase.', 'duration': 25.696, 'max_score': 1010.089, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1010089.jpg'}, {'end': 1085.799, 'src': 'heatmap', 'start': 1056.722, 'weight': 1, 'content': [{'end': 1066.93, 'text': "so the four methods that i'm going to be talking about are apply and map and apply, map and replace.", 'start': 1056.722, 'duration': 10.208}, {'end': 1069.252, 'text': 'oops, let me spell that correctly replace.', 'start': 1066.93, 'duration': 2.322}, {'end': 1071.954, 'text': "so first let's take a look at apply.", 'start': 1069.252, 'duration': 2.702}, {'end': 1081.337, 'text': 'So apply is used for calling a function on our values and apply can work on either a data frame or a series object.', 'start': 1072.694, 'duration': 8.643}, {'end': 1085.799, 'text': 'And the behavior might be a little different than you expect for each of those different objects.', 'start': 1081.737, 'duration': 4.062}], 'summary': 'The methods covered are apply, map, and replace, which can be used on data frames or series objects for calling functions on values.', 'duration': 29.077, 'max_score': 1056.722, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1056722.jpg'}, {'end': 1114.985, 'src': 'embed', 'start': 1086.239, 'weight': 3, 'content': [{'end': 1089.74, 'text': "So first, let's look at how apply works for a series.", 'start': 1086.239, 'duration': 3.501}, {'end': 1095.806, 'text': 'So when we use this on a series, it can apply a function to every value in our series.', 'start': 1090.2, 'duration': 5.606}, {'end': 1100.711, 'text': "So for example, let's say that I want to see the length of all of our email addresses.", 'start': 1096.226, 'duration': 4.485}, {'end': 1106.337, 'text': 'Maybe we have a website and we want to make sure that none of the email addresses are too long or something like that.', 'start': 1100.791, 'duration': 5.546}, {'end': 1114.985, 'text': 'So I can apply the len, the length function, to each value in our series by doing something like this.', 'start': 1106.977, 'duration': 8.008}], 'summary': 'Apply function applies to series for value transformation.', 'duration': 28.746, 'max_score': 1086.239, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1086239.jpg'}, {'end': 1177.29, 'src': 'embed', 'start': 1149.653, 'weight': 4, 'content': [{'end': 1155.455, 'text': "So in this example, I'm just going to create a simple function that returns the uppercase version of our email.", 'start': 1149.653, 'duration': 5.802}, {'end': 1158.696, 'text': 'But the function can be as complicated as you want it to be.', 'start': 1155.855, 'duration': 2.841}, {'end': 1162.337, 'text': 'So let me write a simple function here.', 'start': 1159.476, 'duration': 2.861}, {'end': 1165.439, 'text': 'uh, that does what i wanted to do.', 'start': 1163.017, 'duration': 2.422}, {'end': 1172.946, 'text': "so i'm going to say let's see, i'll call this function update email and this will take in an email value here,", 'start': 1165.439, 'duration': 7.507}, {'end': 1177.29, 'text': "and then i'll just return that email in uppercase.", 'start': 1172.946, 'duration': 4.344}], 'summary': 'Creating a simple function to return the uppercase version of an email.', 'duration': 27.637, 'max_score': 1149.653, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1149653.jpg'}, {'end': 1294.85, 'src': 'embed', 'start': 1268.43, 'weight': 5, 'content': [{'end': 1274.455, 'text': 'Now for simple functions like this, you might see people use lambda functions as well.', 'start': 1268.43, 'duration': 6.025}, {'end': 1276.817, 'text': "Now, if you're not familiar with Lambda functions,", 'start': 1274.915, 'duration': 1.902}, {'end': 1284.682, 'text': 'basically they are anonymous functions with a specific name or without a specific name that we can use for things like this.', 'start': 1276.817, 'duration': 7.865}, {'end': 1287.825, 'text': "So here's what it would look like in this example.", 'start': 1285.163, 'duration': 2.662}, {'end': 1291.307, 'text': "So let's say that I wanted to convert these back to lowercase.", 'start': 1288.265, 'duration': 3.042}, {'end': 1294.85, 'text': 'So what I could do is I will just grab this here.', 'start': 1291.687, 'duration': 3.163}], 'summary': 'Lambda functions are used as anonymous functions for simple tasks like converting text to lowercase.', 'duration': 26.42, 'max_score': 1268.43, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1268430.jpg'}, {'end': 1388.715, 'src': 'embed', 'start': 1356.383, 'weight': 6, 'content': [{'end': 1359.907, 'text': "So far we've only been using this with a series.", 'start': 1356.383, 'duration': 3.524}, {'end': 1363.611, 'text': 'So anytime we access a column like this, that returns a series.', 'start': 1360.067, 'duration': 3.544}, {'end': 1371.48, 'text': 'And again, when we ran apply on the series, it ran a function on all of the values in that series.', 'start': 1364.111, 'duration': 7.369}, {'end': 1378.968, 'text': 'Now when we run apply on a data frame, it runs a function on each row or column of that data frame.', 'start': 1372.1, 'duration': 6.868}, {'end': 1381.972, 'text': "So let's see what this looks like and it should make more sense.", 'start': 1379.409, 'duration': 2.563}, {'end': 1388.715, 'text': 'So let me grab the example above where we ran the lin function right here.', 'start': 1382.412, 'duration': 6.303}], 'summary': 'Using apply with series and data frames to run functions on values and rows/columns.', 'duration': 32.332, 'max_score': 1356.383, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1356383.jpg'}], 'start': 776.636, 'title': 'Pandas dataframe operations and apply method in pandas', 'summary': 'Covers setting with copy warning, using loc or at indexers, updating single and multiple rows of data in a dataframe, and applying the apply, map, and replace methods in pandas. it includes examples of calling functions on series and data frames, updating values, and using lambda functions for simple transformations.', 'chapters': [{'end': 1056.722, 'start': 776.636, 'title': 'Pandas dataframe operations', 'summary': 'Explains the setting with copy warning in pandas dataframe operations, the importance of using loc or at indexers when setting values, and methods for updating single and multiple rows of data in a dataframe using pandas.', 'duration': 280.086, 'highlights': ["The chapter explains the setting with copy warning in Pandas DataFrame operations The transcript discusses the warning message 'setting with copy' in Pandas DataFrame operations, highlighting the issue of trying to directly set a value in a DataFrame and the warning that appears when attempting to do so.", "the importance of using loc or at indexers when setting values The importance of using loc or at indexers when setting values in a DataFrame is emphasized, with the explanation that using these methods avoids the 'setting with copy' issue and ensures the values are set correctly.", 'methods for updating single and multiple rows of data in a DataFrame using Pandas The transcript outlines methods for updating single and multiple rows of data in a DataFrame using Pandas, including examples of changing all email addresses to lowercase and discussing four popular methods for updating multiple rows.']}, {'end': 1408.245, 'start': 1056.722, 'title': 'Pandas apply method', 'summary': 'Introduces the apply, map, and replace methods in pandas, demonstrating how to use apply to call functions on series and data frames, including examples of applying functions to update values and using lambda functions for simple transformations.', 'duration': 351.523, 'highlights': ['The apply method can be used to call a function on every value in a series, demonstrated by applying the len function to each value in an email column, providing insights into the length of email addresses. length of email addresses', 'Demonstrates using the apply method to update values by creating a function to return the uppercase version of email addresses, showcasing the ability to apply transformations to series data. transforming email addresses to uppercase', 'Explains the use of lambda functions for simple transformations, exemplified by converting email addresses to lowercase using a lambda function instead of a regular function. transformation of email addresses to lowercase using lambda functions', "Illustrates how the apply method works with data frames, showing that it runs a function on each row or column of the data frame, providing a comprehensive understanding of the method's functionality. demonstration of apply method on data frames"]}], 'duration': 631.609, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE776636.jpg', 'highlights': ['The chapter explains the setting with copy warning in Pandas DataFrame operations.', 'The importance of using loc or at indexers when setting values in a DataFrame is emphasized.', 'Methods for updating single and multiple rows of data in a DataFrame using Pandas are outlined.', 'The apply method can be used to call a function on every value in a series.', 'Demonstrates using the apply method to update values by creating a function to return the uppercase version of email addresses.', 'Explains the use of lambda functions for simple transformations.', 'Illustrates how the apply method works with data frames, showing that it runs a function on each row or column of the data frame.']}, {'end': 1793.025, 'segs': [{'end': 1453.579, 'src': 'embed', 'start': 1427.184, 'weight': 0, 'content': [{'end': 1433.448, 'text': "so what's going on here is that it's not applying the length function to every value in the data frame.", 'start': 1427.184, 'duration': 6.264}, {'end': 1439.611, 'text': "It's actually applying the length function to each series in the data frame, specifically the columns.", 'start': 1433.828, 'duration': 5.783}, {'end': 1445.273, 'text': 'So basically what this is telling us is that our first name column has a length of three.', 'start': 1439.991, 'duration': 5.282}, {'end': 1448.875, 'text': 'So if we look up here at first, we can see that first has three values.', 'start': 1445.373, 'duration': 3.502}, {'end': 1453.579, 'text': "it's telling us that last has three values and email has three values.", 'start': 1449.275, 'duration': 4.304}], 'summary': 'The length function is applied to each series in the data frame, revealing that the first name, last name, and email columns each have three values.', 'duration': 26.395, 'max_score': 1427.184, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1427184.jpg'}, {'end': 1495.519, 'src': 'embed', 'start': 1471.031, 'weight': 1, 'content': [{'end': 1476.852, 'text': "So that's basically what apply is doing here on the data frame, but it's doing it for every column.", 'start': 1471.031, 'duration': 5.821}, {'end': 1481.273, 'text': 'And you can also have this apply to rows as well if you change the axis.', 'start': 1477.252, 'duration': 4.021}, {'end': 1486.934, 'text': 'So we can change the axis here and say, no, I want to do this on the rows.', 'start': 1481.653, 'duration': 5.281}, {'end': 1489.415, 'text': 'Whoops, and I put row, I meant to put rows.', 'start': 1487.314, 'duration': 2.101}, {'end': 1494.318, 'text': "So if I run this, and I made another mistake here, I actually didn't need to put rows.", 'start': 1489.875, 'duration': 4.443}, {'end': 1495.519, 'text': 'Rows is the default.', 'start': 1494.478, 'duration': 1.041}], 'summary': 'Apply is used on data frame for every column, with option to apply to rows by changing the axis.', 'duration': 24.488, 'max_score': 1471.031, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1471031.jpg'}, {'end': 1548.436, 'src': 'heatmap', 'start': 1513.331, 'weight': 0.719, 'content': [{'end': 1514.652, 'text': "It's not counting it downward.", 'start': 1513.331, 'duration': 1.321}, {'end': 1524.439, 'text': 'so, basically, we want to use functions that will make sense to be used on a series object when using apply on an entire data frame.', 'start': 1515.072, 'duration': 9.367}, {'end': 1529.243, 'text': "so, for example, let's say that we wanted to grab the minimum value from each column.", 'start': 1524.439, 'duration': 4.804}, {'end': 1537.069, 'text': 'well, series objects have a min method, so we could pass that into apply and see the minimum value for each series.', 'start': 1529.243, 'duration': 7.826}, {'end': 1540.611, 'text': 'Now in our sample data frame, we have all string values.', 'start': 1537.509, 'duration': 3.102}, {'end': 1548.436, 'text': "So if we grab the minimum value from a series of strings, then it'll just return the first one in alphabetical order.", 'start': 1540.931, 'duration': 7.505}], 'summary': 'Using apply with series objects to compute minimum value for each column in a data frame.', 'duration': 35.105, 'max_score': 1513.331, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1513331.jpg'}, {'end': 1590.904, 'src': 'heatmap', 'start': 1558.823, 'weight': 0.783, 'content': [{'end': 1563.966, 'text': 'So I could say pd is what we imported pandas as, pd.series.min.', 'start': 1558.823, 'duration': 5.143}, {'end': 1574.013, 'text': "So if I run this, then we can see, okay, it's saying that the one that comes first in the alphabet in the first category is Corey.", 'start': 1565.187, 'duration': 8.826}, {'end': 1577.515, 'text': 'The one that comes first in the last names is Doe.', 'start': 1574.953, 'duration': 2.562}, {'end': 1579.456, 'text': "So that is, you know, that's a D.", 'start': 1577.735, 'duration': 1.721}, {'end': 1580.236, 'text': "These two are S's.", 'start': 1579.456, 'duration': 0.78}, {'end': 1580.897, 'text': 'That makes sense.', 'start': 1580.276, 'duration': 0.621}, {'end': 1584.239, 'text': 'And then my email comes before these other two emails.', 'start': 1581.457, 'duration': 2.782}, {'end': 1590.904, 'text': 'Now it probably would have been better to take a look at this using a series of numerical data instead,', 'start': 1584.679, 'duration': 6.225}], 'summary': 'Using the pandas library, the first alphabetically listed names are corey and doe, with d being the first letter, and the email comes before the other two emails.', 'duration': 32.081, 'max_score': 1558.823, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1558823.jpg'}, {'end': 1637.79, 'src': 'embed', 'start': 1606.377, 'weight': 3, 'content': [{'end': 1608.779, 'text': 'But you just have to remember that the lambda function.', 'start': 1606.377, 'duration': 2.402}, {'end': 1611.58, 'text': 'will be working on a series object.', 'start': 1608.979, 'duration': 2.601}, {'end': 1619.063, 'text': "so if I come down here, I can say df.apply, and now let's pass in a lambda.", 'start': 1611.58, 'duration': 7.483}, {'end': 1620.124, 'text': 'now this x.', 'start': 1619.063, 'duration': 1.061}, {'end': 1623.485, 'text': 'here this x is going to be a series.', 'start': 1620.124, 'duration': 3.361}, {'end': 1625.346, 'text': "it's not going to be a value.", 'start': 1623.485, 'duration': 1.861}, {'end': 1627.647, 'text': 'so what methods do a series have?', 'start': 1625.346, 'duration': 2.301}, {'end': 1630.388, 'text': 'well, a series has a min method.', 'start': 1627.647, 'duration': 2.741}, {'end': 1633.309, 'text': "So let's return the minimum value and run that.", 'start': 1630.788, 'duration': 2.521}, {'end': 1637.79, 'text': 'And we can see that that gives us the same response that this one up here gave us.', 'start': 1633.629, 'duration': 4.161}], 'summary': 'Using lambda function with df.apply on series object to find minimum value.', 'duration': 31.413, 'max_score': 1606.377, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1606377.jpg'}, {'end': 1706.824, 'src': 'heatmap', 'start': 1653.696, 'weight': 0.893, 'content': [{'end': 1661.96, 'text': 'So for example, we could use numpy to apply the square root for all of our series objects or any type of numerical analysis like that.', 'start': 1653.696, 'duration': 8.264}, {'end': 1671.745, 'text': 'Okay, so running apply on a series applies a function to every value in the series and running apply to a data frame.', 'start': 1662.44, 'duration': 9.305}, {'end': 1676.809, 'text': 'like we did here, applies a function to every series in the data frame.', 'start': 1672.185, 'duration': 4.624}, {'end': 1684.735, 'text': "But you might be wondering if there's a way that we can apply a function to every individual element in the data frame.", 'start': 1677.309, 'duration': 7.426}, {'end': 1687.558, 'text': "And that's what apply map is used for.", 'start': 1685.236, 'duration': 2.322}, {'end': 1691.239, 'text': 'And apply map only works on data frames.', 'start': 1688.138, 'duration': 3.101}, {'end': 1694.001, 'text': "Series objects don't have the apply map method.", 'start': 1691.34, 'duration': 2.661}, {'end': 1696.902, 'text': 'So let me show you how this is different.', 'start': 1694.561, 'duration': 2.341}, {'end': 1703.445, 'text': "So again, let's use that same built in length function and pass that into apply map.", 'start': 1697.302, 'duration': 6.143}, {'end': 1705.026, 'text': "So I'll say DF.", 'start': 1703.865, 'duration': 1.161}, {'end': 1706.824, 'text': 'dot apply map.', 'start': 1705.643, 'duration': 1.181}], 'summary': 'Using numpy to apply the square root to series objects and running apply on data frames for numerical analysis. apply map works only on data frames.', 'duration': 53.128, 'max_score': 1653.696, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1653696.jpg'}, {'end': 1705.026, 'src': 'embed', 'start': 1677.309, 'weight': 2, 'content': [{'end': 1684.735, 'text': "But you might be wondering if there's a way that we can apply a function to every individual element in the data frame.", 'start': 1677.309, 'duration': 7.426}, {'end': 1687.558, 'text': "And that's what apply map is used for.", 'start': 1685.236, 'duration': 2.322}, {'end': 1691.239, 'text': 'And apply map only works on data frames.', 'start': 1688.138, 'duration': 3.101}, {'end': 1694.001, 'text': "Series objects don't have the apply map method.", 'start': 1691.34, 'duration': 2.661}, {'end': 1696.902, 'text': 'So let me show you how this is different.', 'start': 1694.561, 'duration': 2.341}, {'end': 1703.445, 'text': "So again, let's use that same built in length function and pass that into apply map.", 'start': 1697.302, 'duration': 6.143}, {'end': 1705.026, 'text': "So I'll say DF.", 'start': 1703.865, 'duration': 1.161}], 'summary': 'Apply map applies a function to every element in a data frame', 'duration': 27.717, 'max_score': 1677.309, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1677309.jpg'}], 'start': 1408.626, 'title': 'Using pandas apply methods', 'summary': 'Explains the use of df.apply method to apply a function to each series in a dataframe, with an example of applying the length function, and also discusses using apply and apply map functions, with examples of series.min method, lambda functions, and the difference between apply and apply map.', 'chapters': [{'end': 1494.318, 'start': 1408.626, 'title': 'Understanding pandas dataframe apply method', 'summary': 'Explains the use of the df.apply method to apply a function to each series (column) in a dataframe, with an example of applying the length function to determine the number of values in each column, revealing that each series has three values.', 'duration': 85.692, 'highlights': ['The df.apply method applies the length function to each series (column) in the DataFrame, revealing the number of values in each column, which in this case is three.', 'By changing the axis parameter, the apply method can also be used to operate on rows rather than columns.']}, {'end': 1793.025, 'start': 1494.478, 'title': 'Using apply and apply map in pandas', 'summary': 'Explains how to use the apply and apply map functions in pandas to apply a function to every value in a series or data frame, with examples demonstrating the use of series.min method, lambda functions, and the difference between apply and apply map.', 'duration': 298.547, 'highlights': ['The chapter explains how to use the apply and apply map functions in Pandas to apply a function to every value in a series or data frame. Explanation of using apply and apply map functions in Pandas.', 'Examples demonstrating the use of series.min method, lambda functions, and the difference between apply and apply map. Demonstration of using series.min method, lambda functions, and the difference between apply and apply map.']}], 'duration': 384.399, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1408626.jpg', 'highlights': ['The df.apply method applies the length function to each series in the DataFrame, revealing the number of values in each column.', 'The apply method can also be used to operate on rows rather than columns by changing the axis parameter.', 'The chapter explains how to use the apply and apply map functions in Pandas to apply a function to every value in a series or data frame.', 'Examples demonstrating the use of series.min method, lambda functions, and the difference between apply and apply map.']}, {'end': 2389.971, 'segs': [{'end': 1825.979, 'src': 'embed', 'start': 1793.525, 'weight': 0, 'content': [{'end': 1797.987, 'text': "Okay, so now we've looked at apply and apply map, and hopefully those make more sense to you now.", 'start': 1793.525, 'duration': 4.462}, {'end': 1800.648, 'text': "So now let's look at the map method.", 'start': 1798.568, 'duration': 2.08}, {'end': 1803.87, 'text': 'Now the map method only works on a series.', 'start': 1801.109, 'duration': 2.761}, {'end': 1809.392, 'text': 'So map is used for substituting each value in a series with another value.', 'start': 1804.37, 'duration': 5.022}, {'end': 1815.215, 'text': "So for example, let's say that we wanted to substitute a couple of our first names.", 'start': 1809.792, 'duration': 5.423}, {'end': 1825.979, 'text': 'So to do this, I could say df and access that first name column, which is also a series, and then I can use the map method on this.', 'start': 1815.635, 'duration': 10.344}], 'summary': 'The map method is used to substitute each value in a series with another value, working exclusively on series.', 'duration': 32.454, 'max_score': 1793.525, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1793525.jpg'}, {'end': 1913.714, 'src': 'embed', 'start': 1887.198, 'weight': 1, 'content': [{'end': 1892.602, 'text': "So, instead of doing what we did here, I'll just copy this, paste this in here.", 'start': 1887.198, 'duration': 5.404}, {'end': 1895.364, 'text': 'Instead of using map, I can use replace.', 'start': 1893.102, 'duration': 2.262}, {'end': 1905.329, 'text': "replace. and if I run this, then now we can see that it's basically the exact same result here, except now we actually have it.", 'start': 1895.604, 'duration': 9.725}, {'end': 1913.714, 'text': "didn't replace John with an nan value and again, everything that we've done here doesn't actually change the data frame.", 'start': 1905.329, 'duration': 8.385}], 'summary': "Using 'replace' instead of 'map' produced the same result without replacing 'john' with a nan value.", 'duration': 26.516, 'max_score': 1887.198, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1887198.jpg'}, {'end': 1960.828, 'src': 'embed', 'start': 1933.49, 'weight': 2, 'content': [{'end': 1938.816, 'text': "Okay so, now that we've looked at a lot of different ways of updating information in our rows and columns,", 'start': 1933.49, 'duration': 5.326}, {'end': 1944.862, 'text': "now let's go over to our larger data set and look at some real world examples of how we can apply what we've learned here.", 'start': 1938.816, 'duration': 6.046}, {'end': 1949.104, 'text': 'So let me go over to my Stack Overflow survey data here.', 'start': 1945.242, 'duration': 3.862}, {'end': 1955.186, 'text': "So we have our Stack Overflow survey notebook open here that we've been using throughout this series.", 'start': 1949.524, 'duration': 5.662}, {'end': 1960.828, 'text': "And again, if you'd like to download these notebooks or the Stack Overflow data in order to follow along,", 'start': 1955.606, 'duration': 5.222}], 'summary': 'Explore real world examples with stack overflow survey data.', 'duration': 27.338, 'max_score': 1933.49, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1933490.jpg'}, {'end': 2056.295, 'src': 'embed', 'start': 2025.87, 'weight': 3, 'content': [{'end': 2032.293, 'text': 'So if I run this, then let me go over here and see if this looks good.', 'start': 2025.87, 'duration': 6.423}, {'end': 2034.294, 'text': 'Okay, so that looks good.', 'start': 2032.834, 'duration': 1.46}, {'end': 2035.275, 'text': 'That changed.', 'start': 2034.494, 'duration': 0.781}, {'end': 2041.138, 'text': "Now, after you make sure that it made the change that you wanted it to make and that it's not a mistake,", 'start': 2035.675, 'duration': 5.463}, {'end': 2043.639, 'text': 'then we can actually apply that to our data frame.', 'start': 2041.138, 'duration': 2.501}, {'end': 2047.243, 'text': 'By setting in place is equal to true.', 'start': 2044.079, 'duration': 3.164}, {'end': 2056.295, 'text': "Now. that's why, in place equal to true is actually a good idea, because sometimes you know, when you're working in pandas,", 'start': 2047.724, 'duration': 8.571}], 'summary': "Applying changes to data frame with 'in place' setting in pandas.", 'duration': 30.425, 'max_score': 2025.87, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE2025870.jpg'}, {'end': 2153.572, 'src': 'embed', 'start': 2116.27, 'weight': 4, 'content': [{'end': 2118.071, 'text': 'Let me actually print this out down here.', 'start': 2116.27, 'duration': 1.801}, {'end': 2121.574, 'text': 'So I will access that hobbyist column.', 'start': 2118.592, 'duration': 2.982}, {'end': 2125.157, 'text': 'And we can see that this is a bunch of yes, no values here.', 'start': 2122.095, 'duration': 3.062}, {'end': 2134.783, 'text': "So let's say that we wanted to convert these values and map all of the yes responses to a true boolean value and the no's to false.", 'start': 2125.578, 'duration': 9.205}, {'end': 2141.246, 'text': 'So how would we do this? Well, one way that we could do this is with the map method that we just learned about.', 'start': 2135.303, 'duration': 5.943}, {'end': 2153.572, 'text': 'So what we could do is we could say DF Hobbyist dot map and then pass in a dictionary here of the substitutions that we want to make.', 'start': 2141.786, 'duration': 11.786}], 'summary': 'Using the map method to convert yes/no values to boolean in the hobbyist column.', 'duration': 37.302, 'max_score': 2116.27, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE2116270.jpg'}, {'end': 2339.64, 'src': 'embed', 'start': 2309.264, 'weight': 6, 'content': [{'end': 2314.566, 'text': 'And also the first 200 people that go to that link will get 20% off the annual premium subscription.', 'start': 2309.264, 'duration': 5.302}, {'end': 2317.348, 'text': 'And you can find that link in the description section below.', 'start': 2314.947, 'duration': 2.401}, {'end': 2321.549, 'text': "Again, that's brilliant.org forward slash CMS.", 'start': 2317.908, 'duration': 3.641}, {'end': 2325.031, 'text': "OK, so I think that's going to do it for this pandas video.", 'start': 2322.93, 'duration': 2.101}, {'end': 2330.315, 'text': 'I hope you feel like you got a good idea for how we can update the information within our rows and columns.', 'start': 2325.051, 'duration': 5.264}, {'end': 2339.64, 'text': 'We started off a bit simple, making changes in specific spots and then going a little more advanced when we learned about apply map and apply map.', 'start': 2330.855, 'duration': 8.785}], 'summary': '200 people can get 20% off annual premium subscription at brilliant.org/cms. video covered updating information in rows and columns using pandas.', 'duration': 30.376, 'max_score': 2309.264, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE2309264.jpg'}, {'end': 2370.957, 'src': 'embed', 'start': 2347.225, 'weight': 7, 'content': [{'end': 2354.448, 'text': 'Now, originally, I was also going to show how to add and remove rows and columns in this video, but this is getting a bit long.', 'start': 2347.225, 'duration': 7.223}, {'end': 2357.09, 'text': "So I'm just going to save that for our next video.", 'start': 2354.808, 'duration': 2.282}, {'end': 2361.912, 'text': "So in the next video, we'll learn how to add and remove rows and columns from our data frame.", 'start': 2357.49, 'duration': 4.422}, {'end': 2364.373, 'text': 'And that should be a much shorter video.', 'start': 2362.312, 'duration': 2.061}, {'end': 2369.797, 'text': 'But if anyone has any questions about what we covered in this video, then feel free to ask in the comment section below,', 'start': 2364.893, 'duration': 4.904}, {'end': 2370.957, 'text': "and I'll do my best to answer those.", 'start': 2369.797, 'duration': 1.16}], 'summary': 'Next video will cover adding/removing rows and columns, aiming for a shorter duration.', 'duration': 23.732, 'max_score': 2347.225, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE2347225.jpg'}], 'start': 1793.525, 'title': 'Pandas series: map method and data frame value update', 'summary': "Discusses the map method in pandas for value substitution and demonstrates its use with examples, along with the application of the replace method. it also showcases the conversion of 'yes' to true and 'no' to false, and highlights a 20% discount offer from sponsor brilliant.org.", 'chapters': [{'end': 2141.246, 'start': 1793.525, 'title': 'Pandas series: map method', 'summary': 'Discusses the map method in pandas, which is used for substituting each value in a series with another value, and demonstrates how to use it with examples, also showing the use of the replace method. it also covers the application of the learned methods to a real-world stack overflow survey data set.', 'duration': 347.721, 'highlights': ["The map method in Pandas is used for substituting each value in a series with another value. The map method is demonstrated as a way to substitute values in a series, such as substituting 'Corey' with 'Chris' and 'Jane' with 'Mary'.", 'The replace method in Pandas is an alternative to the map method for substituting values in a series, and it retains the original values not specified for substitution. The replace method is introduced as an alternative to the map method, demonstrating the retention of original values not specified for substitution, unlike the map method which converts them to NAN values.', "The application of the rename method to change the column name in a data frame is demonstrated using the Stack Overflow survey data set. The usage of the rename method to change the column name 'converted comp' to 'salary USD' in a data frame is illustrated using the Stack Overflow survey data set.", "The importance of setting 'inplace=True' when applying changes to a data frame is emphasized as a good practice to solidify the changes only after confirming their accuracy. The significance of setting 'inplace=True' when applying changes to a data frame is highlighted, ensuring that changes are solidified only after confirming their accuracy, thus preventing unintended mistakes.", "Demonstration of using the map method to convert 'yes' and 'no' responses in a column to boolean values by mapping them to 'True' and 'False' respectively. The map method is shown to convert 'yes' responses to 'True' and 'no' responses to 'False' in a column, showcasing the practical application of the map method."]}, {'end': 2389.971, 'start': 2141.786, 'title': 'Pandas data frame value update', 'summary': "Demonstrates using the map method in pandas to convert 'yes' values to true and 'no' values to false, and highlights the sponsor, brilliant.org, offering a 20% discount for the first 200 sign-ups.", 'duration': 248.185, 'highlights': ["The map method is used to convert 'yes' values to True and 'no' values to False, resulting in all 'yeses' mapped to True and all 'nos' mapped to False.", 'Sponsor mention: Brilliant.org offers a 20% discount for the first 200 sign-ups through the link brilliant.org/CMS.', 'The next video will cover adding and removing rows and columns from the data frame.']}], 'duration': 596.446, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/DCDe29sIKcE/pics/DCDe29sIKcE1793525.jpg', 'highlights': ['The map method in Pandas is used for substituting each value in a series with another value.', 'The replace method in Pandas is an alternative to the map method for substituting values in a series, and it retains the original values not specified for substitution.', 'The application of the rename method to change the column name in a data frame is demonstrated using the Stack Overflow survey data set.', "The importance of setting 'inplace=True' when applying changes to a data frame is emphasized as a good practice to solidify the changes only after confirming their accuracy.", "Demonstration of using the map method to convert 'yes' and 'no' responses in a column to boolean values by mapping them to 'True' and 'False' respectively.", "The map method is used to convert 'yes' values to True and 'no' values to False, resulting in all 'yeses' mapped to True and all 'nos' mapped to False.", 'Brilliant.org offers a 20% discount for the first 200 sign-ups through the link brilliant.org/CMS.', 'The next video will cover adding and removing rows and columns from the data frame.']}], 'highlights': ['The chapter covers learning how to alter existing rows and columns in data frames, including updating data for rows and columns and adding/removing rows and columns.', 'The chapter demonstrates using techniques to make changes to the data based on concepts previously learned.', 'The tutorial is accompanied by a snippets file for demonstration purposes.', 'The chapter demonstrates renaming all columns by using the columns attribute and passing in a list of new column names, such as first name, last name, and keeping email the same.', "The method to update columns involves using the rename method and passing in a dictionary of the columns to be changed, with the need to set 'in place' to true to make the change go through.", 'Using list comprehension, the chapter shows how to change all column names to uppercase letters by applying the upper() function to each column name.', 'The chapter illustrates how to replace spaces with underscores in column names using the str method and the replace method from the string class, ensuring correct syntax for accessing column names.', 'The chapter explains how to modify a single value in a Pandas data frame by passing in a single row and a single column, rather than a list, demonstrating the ability to change specific cells without the need for passing lists.', 'The chapter introduces the .loc indexer in Pandas, showcasing its usage for changing or looking up a single value within a data frame.', 'The chapter discusses the use of .at method in Pandas for getting or setting a single value, emphasizing its potential performance benefits.', 'The speaker demonstrates the process of using a filter to grab a specific row in a large data frame, showcasing the correct application of indexers for efficient data manipulation.', 'The chapter explains the setting with copy warning in Pandas DataFrame operations.', 'The apply method can be used to call a function on every value in a series.', 'The df.apply method applies the length function to each series in the DataFrame, revealing the number of values in each column.', 'The map method in Pandas is used for substituting each value in a series with another value.', 'The replace method in Pandas is an alternative to the map method for substituting values in a series, and it retains the original values not specified for substitution.', 'The application of the rename method to change the column name in a data frame is demonstrated using the Stack Overflow survey data set.', "The importance of setting 'inplace=True' when applying changes to a data frame is emphasized as a good practice to solidify the changes only after confirming their accuracy.", "Demonstration of using the map method to convert 'yes' and 'no' responses in a column to boolean values by mapping them to 'True' and 'False' respectively.", 'Brilliant.org offers a 20% discount for the first 200 sign-ups through the link brilliant.org/CMS.']}