Skip to content

Instantly share code, notes, and snippets.

@dsdanielpark
Created April 6, 2023 08:19
Show Gist options
  • Save dsdanielpark/1ae8a8ae158ae08e232ba6734fa4216b to your computer and use it in GitHub Desktop.
Save dsdanielpark/1ae8a8ae158ae08e232ba6734fa4216b to your computer and use it in GitHub Desktop.
Converting String-formatted Arrays Back to Array Objects in Multidimensional Embedded Arrays from CSV Files

When a multidimensional embedded array is saved as a string in a CSV file, you can load it back and convert the string-formatted array into an array object.

def convert(item):
    item = item.strip()  
    item = item[1:-1]   
    item = np.fromstring(item, sep=' ') 
    return item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment