Chartjs-How can i change a numpy.ndarray to point format with curly brackets โ€“ Python 3.7

0๐Ÿ‘

โœ…

You can use list comprehension:

new_result = [{'x': el[0], 'y': el[1]} for el in result]

0๐Ÿ‘

try sth like:

def convert_array(arr):
    return [{'x':item[0],'y':item[1]} for item in arr]

use as:

converted_array = convert_array(numpy_array)

Leave a comment