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

0 votes
May 14 in Python by Shabnam
• 920 points

1 answer to this question.

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
• 1,040 points

Related Questions In Python

0 votes
1 answer

What is the patterns package in python used for?

Pattern is a web mining tool in ...READ MORE

answered Jul 31 in Python by Mohammad
• 3,060 points
0 votes
0 answers
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,900 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
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 328 views
+4 votes
6 answers
0 votes
1 answer

assert keyword in python is used for what purpose?

The assert keyword is used while debugging ...READ MORE

answered May 24 in Python by Taj
• 1,040 points
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
• 1,040 points

edited Mar 18 by Omkar 5,575 views