Skip to content

Instantly share code, notes, and snippets.

@debaonline4u
Created August 1, 2018 05:42
Show Gist options
  • Save debaonline4u/dc21b4f7b03995f6f2d2db46120e422a to your computer and use it in GitHub Desktop.
Save debaonline4u/dc21b4f7b03995f6f2d2db46120e422a to your computer and use it in GitHub Desktop.
create string type array using numpy array()
# Python program to create a string type array using numpy array() method.
from numpy import *
arr = array(['Delhi', 'Mumbai', 'Hyderabad', 'Bengaluru', 'Bhubneswar', 'Baroda'])
# Creating an array from another array.
arr2 = array(arr)
arr3 = arr
# display the arrays:
print('arr = ', arr)
print('arr2 = ', arr2)
print('arr3 = ', arr3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment