Answers for "Fix TypeError: only integer scalar arrays can be converted to a scalar index"

0

Fix TypeError: only integer scalar arrays can be converted to a scalar index

# import numpy
import numpy

# Create 2 different arrays
ar1 = numpy.array(['Apple', 'Orange', 'Banana', 'Pineapple', 'Grapes'])
ar2 = numpy.array(['Onion', 'Potato'])

# Concatenate array ar1 & ar2 using numpy.concatenate()
ar3 = numpy.concatenate([ar1, ar2])
print(ar3)

# Output
['Apple' 'Orange' 'Banana' 'Pineapple' 'Grapes' 'Onion' 'Potato']
Posted by: Guest on September-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language