Necessary data structure for making heatmaps in Python
Question: **EDIT** Just realized the way I was parsing in the data was deleting numbers
so I didn't have an array for the correct shape. Thanks mgilson, you provided
fantastic answers!

I'm trying to make a heatmap of data using python. I have found this basic
code that works:

    
    
    import matplotlib.pyplot as plt
    import numpy as np
    
    data = np.random.rand(3,3)
    
    fig, ax = plt.subplots()
    heatmap = ax.pcolor(data, cmap=plt.cm.Blues)
    plt.show()
    
    f.close()
    

However, when I try to put in my data, which is currently formatted as a list
of lists (data=[[1,2,3],[1,2,3],[1,2,3]]), it gives me the error:
AttributeError: 'list' object has no attribute 'shape.'

What is the data structure that np.random.rand() produces/ python uses for
heatmaps? How do I convert my list of lists into that data structure? Thanks
so much!

This is what my data looks like, if that helps:

    
    
    [[0.174365079365079, 0.147356200527704, 0.172903394255875, 0.149252948885976, 0.132479381443299, 0.279736780258519, 0.134908163265306, 0.127802340702211, 0.131209302325581, 0.100632627646326, 0.127636363636364, 0.146028409090909], 
     [0.161473684210526, 0.163691529709229, 0.166841698841699, 0.144, 0.13104, 0.146225563909774, 0.131002409638554, 0.125977358490566, 0.107940372670807, 0.100862068965517, 0.13436641221374, 0.130921518987342], 
     [0.15640362225097, 0.152472361809045, 0.101713567839196, 0.123847328244275, 0.101428924598269, 0.102045112781955, 0.0999014778325123, 0.11909887359199, 0.186751958224543, 0.216221343873518, 0.353571428571429], 
     [0.155185378590078, 0.151626168224299, 0.112484210526316, 0.126333764553687, 0.108763358778626], 
     [0.792675, 0.681526248399488, 0.929269035532995, 0.741649167733675, 0.436010126582278, 0.462519447929736, 0.416332480818414, 0.135318181818182, 0.453331639135959, 0.121893919793014, 0.457028132992327, 0.462558139534884], 
     [0.779800766283525, 1.02741401273885, 0.893561712846348, 0.710062015503876, 0.425114754098361, 0.388704980842912, 0.415049608355091, 0.228122605363985, 0.128575796178344, 0.113307392996109, 0.404273195876289, 0.414923673997413], 
     [0.802428754813864, 0.601316326530612, 0.156620689655172, 0.459367588932806, 0.189442875481386, 0.118344827586207, 0.127080939947781, 0.2588, 0.490834196891192, 0.805660574412533, 3.17598959687906], 
     [0.873314136125655, 0.75143661971831, 0.255721518987342, 0.472793854033291, 0.296584980237154]]
    


Answer: It's a `numpy.ndarray`. You can construct it easily from your data:

    
    
    import numpy as np
    data = np.array([[1,2,3],[1,2,3],[1,2,3]])
    

(`np.asarray` would also work -- If given an array, it just returns it,
otherwise it constructs a new one compared to `np.array` which always
constructs a new array)

