How do I use string methods in pandas?

preview_player
Показать описание
pandas includes powerful string manipulation capabilities that you can easily apply to any Series of strings. In this video, I'll show you how to access string methods in pandas (along with a few examples), and then end with two bonus tips to help you maximize your efficiency.

SUBSCRIBE to learn data science with Python:

JOIN the "Data School Insiders" community and receive exclusive rewards:

== RESOURCES ==

== LET'S CONNECT! ==
Рекомендации по теме
Комментарии
Автор

Hands down one the best channels for learning data science. The small cues you explain besides the normal code give you the edge over others.

PS. You remind me of Sheldon from Big Bang Theory

y_rb
Автор

Keep doing the good work. love your videos and your way of explanation. Most other tutors on youtube often rush things or aren't clear on what they are saying. you have a strong, clear and loud voice. this makes things easy to understand. thanks.

shivamvikal
Автор

your pace and teaching method is really good man great work

technewbea
Автор

regular expressions are useful, i'm glad you included that in the video as well. it's def a bonus

sergeiklimkov
Автор

Excellent video but I am looking for the next level which is super easy with SQL.
I am looking the SQL equivalent of replacing a string with a sub-string. Assuming you had a date formatted as "xxYYYYMMDDhhmm" and you wanted to extract only the YYYYMMDD.
Using SQL you would do something like:
Update Tbl set DColumn = substring(DColumn, 3, 8) where ....


I used your method df['DColumn'].str[2:10] and got what I needed and tried to use str.replace but I was not able to get it to work. I am thinking there should be a simple solution but I am not seeing it. I am thinking my SQL background is getting in my way.


Do you have any suggestions of know of another video that may point me in the right direction? Thanks.

hectors
Автор

Hey man these are really, really great lessons, I love the way you break down the processes.

I had a question question about applying multiple queries but I saw you had another video on that which was exactly what I needed!

About to start playing with scikit-learn so excited that you've got videos on that.

BTW your voice sounds kinda like a deeper version of Sheldon from Big Bang Theory. It's pretty cool.

olabrew
Автор

It is like the fourth time I've just understood something and I cant really get in other places like stack overflow or somewhere else. You are a good teacher, besides that now I am use to do things propperly using loc, iloc or ix well with the :, ex .loc[:, 'THANKS']

borjagonzalez
Автор

Schools as we know them are absolete.
This form of teaching is available anytime, anywhere and is interactive with teacher and viewers.
Content view is concise and of much higher quality or allows discussion possibility.
Precise digital content can be searched.
Right teacher for right student is easily accessible.
Student can now concentrate on their goals and ideals instead of following heavy curriculum.

As always 'data school' set an example of ideal teaching! Thank you, much appreciated.

Muuip
Автор

Hi Kevin, how to make the changes permanent to the data set while using
str.replace( ) method.

gunjankumar
Автор

little related to core programming
so orders.item_name is an attribute, right?
and then orders.item_name.str is an object belonging to StringMethods Class. Correct me if I am wrong.

chirag
Автор

Thanks for your tutorials. This series really helps me a lot! I have a question. When using replace( ' [ ', '' ), it shows a future warning that: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will*not* be treated as literal strings when regex=True.
i'm not sure what this mean. Thanks.

ireneshiang
Автор

I'm trying to use the .str.replace() method on a column of a dataframe which includes alphanumeric entries and just numeric entries(e.g. "str-123" and "123". When I do this, the replace works fine, but the resulting series also returns "NaN" where all numeric entries were before. Do you know why this happens (e.g. "123" changes to "NaN")?

tylercapps
Автор

Thank you, brother. Why do we need to use .str? why can't it work without .str?

TheOntheskies
Автор

time
0 07:20AM
1 07:36PM
2 07:02AM
3 08:20PM
4 7:45Am
5 12:20PM
6 8:12PM
7 9:01AM
8 8:00PM
9 2:15PM
10 7:35PM
11 06:50:00
12 08:40PM
df.time.str.replace('AM', ' ', case=False)
df.time.str.replace('PM', ' ', case=False)
Is there way to do both AM and PM at once?
can we use inplace=True to keep the change permanently ?

da_ta
Автор

Hi, Kevin,
love your video series so much!
I have a question, is, that how I can apply string methods for multi-columns;
I have tried several times, but response is that 'DataFrame' object has no attribute 'str';
so, please help me, thanks in advance

andyyuan
Автор

Can I strip away string characters and perform a math function on a value, txload 1/255, remove txload and then do a division problem on the 1/255

jaymanfred
Автор

Wow, well described! Not so well in the Pandas Docs. Could have saved me days literally.

joro
Автор

I searched in the latest docs, it doesn't have string handling. What have they replaced it with?

karangupta
Автор

Hi Kevin, Thank you!! for all your works, your patience is superhuman.

sundeepradhakrishnan
Автор

sir i have a question that how we can calculate occurence of all alphabet in multiple strings

ashishgrover
visit shbcf.ru