Ah, hi, and welcome. I hope you are good. This video is about how to extract our minute and second information from daytime daytime column using pandas. So basically suppose you have a data frame, which has a column which has date/time information in it and you want to extract the hour minute and second details from this from this column, so let’s start and I’ll be importing first of all pandas so import pandas SPD now here I have created a scenario and I have taken a small sample data from the bike sharing data set from the Capital Bikeshare website now. If you look at this website so now, this data has lot of information and one of the information that we will use is the start date information. Now there are multiple trips. It has start date end date duration. Start station and end station, so you can. If you want, you can download the data set from here now. There will be multiple data sets available. You can take any one of them so here since I want to show you how to extract, so I have taken a very small sample of it and basically, I have taken about six seven different rows from this data, which has the date. Now lets. Run this okay now. So we have a data frame, which has a column called. Start date now as you can see. There are multiple dates here, so our objective is to extract the hour. For example, in this case, it’s 15 then minutes 23 then seconds 25 now. I made another video where the objective was to fetch that year month and day information from from a particular date, so I’ll put the link of that video in the description. So now we have the data frame and we have a particular column, which has that which has a date information. So let let’s first Look how the data looks like so. DM, okay, so as you can see, it has only one column start date and it is of the type object now for for the ease of extracting the this information like hours minutes and dates, its advisable First is to convert this column into a date/time object called a time column so to do that, we’ll use our pandas itself, so let’s do that. EF column name start date so well. It is of the type object, so we’ll convert this into a date/time object. So what that what we’ll do is copy this equal to PD Dot to date/time? This is very important. If we don’t do this, then the later part of the extraction won’t work properly. Okay, now, let’s see how that data looks like now as you can see. It has changed from date/time from object to date/time, 64 or data type. Now we can extract multiple information from informations from it, so for example, if we want to extract the minute information, so what we need to do is take that series, so we have to take that particular series in the data frame. We have to use the DT accessor, and then minute DT dot M I nu te. It should not take this long, okay. I’ll just stop this kernel and restart it again. Okay, okay, so as you can see the minute. Information is if this has been extracted. Actually, it should be our first. Hou are so edge. So we have extracted the of information 15 In this case. It’s 0 19 19 12 it, Dean, and then Kate. Okay, so now let now let’s extract the minute information so instead of a minute, there was I since I copied it from there itself, so we just need to put them in it so okay, so, for example, in this In the first case, it’s 23 then 12 then 55 24 25 11 and 2 so we have extracted the minute information how to extract the second information. All we need to do is instead of minute or hour. We need to put second, so start date dot. DT dot second. Okay, So we have extracted the second information. Now let’s add these in these hour minute and second formation to the data frame itself. So what, I mean by that is I? Add the columns by the name hour minute and seconds in the data frame itself so to do that, we just need to write create new column, so power is equal to DT again. I will repeat the same thing, Start date or DT dot power. Let’s look at this now so we have added one column with the hours. Now, let’s create the minute column so instead of our. I’ll put a minute and here It’s Mi nu te minute, okay, So we have called created on the column called minute. Now let’s create the second column so instead of our its sec over nd s e. Co and second, Okay, So I’m creating the column name with the same name so okay, so we have extracted the hour minute and second information, so this is very useful when you are working with the data frame, which has a column of the time date time, so you can do lot of other manipulations, for example. If you want to know what, what is the total minutes, you just multiply hours by 60 and then add to the minute, so let’s write our write down and write down The summary of what we did. Summary first thing is if required, convert the series in our case, it was DT and this DF underscore start date to date time object using PD dot to date time. Okay, second is to extract this the our information we need to do second three series dot treat using the DT exercise dot over extract the minute information it should it would be series or DT dot minute and then series DOT DT Dot second. So here we are. We extracted the hour minute and second information from from the date time, So that’s all for the for today’s video for this video, and I hope it was useful. Thank you and take care.