#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2019/1/4 11:19
# @Author  : TOM.LEE
# @Site    : https://github.com/amlyj/pythonStudy
# @File    : numpy_tools.py
# @Software: PyCharm
import json
import numpy as np

s = """[-0.04762005,  0.0879169 ,  0.0023063 , -0.03706579, -0.11898951,
       -0.02108392, -0.07901215, -0.10485205,  0.11155544, -0.06501016,
        0.27164233, -0.01646846, -0.24037562, -0.10016143, -0.05743476,
        0.17553096, -0.16749673, -0.11541863, -0.02378321,  0.04647258,
        0.15367952,  0.02287174,  0.03457755,  0.01787883, -0.11405148,
       -0.3163996 , -0.0998488 , -0.05756015,  0.02199801, -0.06374203,
       -0.03581371,  0.08284424, -0.17235474, -0.0227249 ,  0.0660641 ,
        0.06384651, -0.01872962, -0.02508127,  0.16338706, -0.04000772,
       -0.27003023,  0.02572771,  0.0550474 ,  0.2095702 ,  0.18521437,
       -0.02408141,  0.04359197, -0.18026267,  0.05561215, -0.12025832,
        0.06702988,  0.16006519,  0.10256888,  0.06740115,  0.00806557,
       -0.12090958,  0.01547574,  0.13361521, -0.09779184, -0.00752856,
        0.09947434, -0.04152099, -0.02395528, -0.08814822,  0.16297641,
       -0.00342272, -0.12797463, -0.23295592,  0.08935639, -0.13063465,
       -0.094975  ,  0.13246778, -0.18144786, -0.19804329, -0.2913368 ,
       -0.0134091 ,  0.39432788,  0.05914842, -0.21796644,  0.08806603,
       -0.02738781, -0.04665986,  0.12764892,  0.13903865,  0.0211947 ,
        0.04681748, -0.10442454,  0.04797503,  0.23688643, -0.11435021,
       -0.00740726,  0.24582928,  0.01062281,  0.0937551 ,  0.04397227,
        0.04731196,  0.01299004,  0.05813394, -0.12070068, -0.00185165,
        0.00733847, -0.06166402, -0.04130287,  0.09028884, -0.10382231,
        0.1078925 ,  0.037964  ,  0.09224172,  0.02660328, -0.02453656,
       -0.11619754, -0.08983426,  0.1368787 , -0.23819852,  0.21031888,
        0.1408934 ,  0.09249996,  0.05336162,  0.12202349,  0.09608915,
        0.00800006, -0.06757922, -0.2254944 ,  0.04057773,  0.11452086,
       -0.06452619,  0.04698323, -0.02416948]"""

# str to ndarray str
s1 = np.asarray(s)
print s1
print s1.dtype


# str to ndarray float64
s2 = np.array(json.loads(s))
print s2
print s2.dtype
