1df1 = pd.DataFrame({'a': [1, 2]})
2df2 = pd.DataFrame({'b': [3, 1]})
3
4df1.columns = ['b']
5
6df1.merge(df2, on='b')
7# b
8# 0 1
9
1# import numpy
2import numpy
3
4# Create 2 different arrays
5ar1 = numpy.array(['Apple', 'Orange', 'Banana', 'Pineapple', 'Grapes'])
6ar2 = numpy.array(['Onion', 'Potato'])
7
8# Concatenate array ar1 & ar2 using numpy.concatenate()
9ar3 = numpy.concatenate(ar1, ar2)
10print(ar3)
11
12# Output
13Traceback (most recent call last):
14 File "c:\Projects\Tryouts\listindexerror.py", line 9, in <module>
15 ar3 = numpy.concatenate(ar1, ar1)
16 File "<__array_function__ internals>", line 5, in concatenate
17TypeError: only integer scalar arrays can be converted to a scalar index
1# import numpy
2import numpy
3
4# Create 2 different arrays
5ar1 = numpy.array(['Apple', 'Orange', 'Banana', 'Pineapple', 'Grapes'])
6ar2 = numpy.array(['Onion', 'Potato'])
7
8# Concatenate array ar1 & ar2 using numpy.concatenate()
9ar3 = numpy.concatenate([ar1, ar2])
10print(ar3)
11
12# Output
13['Apple' 'Orange' 'Banana' 'Pineapple' 'Grapes' 'Onion' 'Potato']