.join() method is used for what purpose in Python?

0 votes
May 14 in Python by Shabnam
• 170 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

join() method is used to concatenate or join all the iterables into one string, and this string must be specified as the separator.




Lets join a list with ','.

>>mylist = ['1', '2', '3', '4', '5']
>>S = ","
#joins elements of mylist with S and store it in string S
>>S = S.join(mylist)

Now let's join two dataframes using join() method

>>import numpy as np
>>import pandas as pd 
>>df1 = pd.DataFrame({'A': ['A0', 'A1', 'A2', 'A3']})                   
>>df2 = pd.DataFrame({'B': ['B0', 'B1', 'B2', 'B3']}) 
0 A0 B0
1 A1 B1
2 A2 B2
3 A3 B3
answered May 14 by Taj
• 240 points

Related Questions In Python

0 votes
1 answer

What is the flow control for “continue” in python?

This is the way "continue" statement works! You ...READ MORE

answered Jul 16, 2018 in Python by Priyaj
• 56,120 points
+1 vote
1 answer

What is the correct order to learn concepts in Python for machine learning?

Machine Learning is a vast domain. It ...READ MORE

answered Jul 25, 2018 in Python by ANMOL
• 3,620 points
+1 vote
1 answer

What is the function for Factorial in Python

Easiest way: math.factorial(x) (available in 2.6 and ...READ MORE

answered Aug 21, 2018 in Python by Priyaj
• 56,120 points

edited Aug 21, 2018 by Omkar 55 views
0 votes
2 answers

What is the python keyword “with” used for?

Please visit this site to know abt ...READ MORE

answered Aug 31, 2018 in Python by Somesh
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
+4 votes
6 answers
0 votes
1 answer

In Python, what is difference between Array and List?

Lists and arrays are used in Python ...READ MORE

answered Mar 15 in Python by Taj
• 240 points

edited Mar 18 by Omkar 109 views
+1 vote
1 answer

How can I reverse list in Python?

Reversing a list is a commonly used ...READ MORE

answered May 13 in Python by Taj
• 240 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.