一枚Python数据工程师为妈妈写的几行代码

释放双眼,带上耳机,听听看~!
if __name__=="__main__":
    import seaborn as sns
    import numpy as np
    from pylab import *
    #Define Data
    data=np.zeros([64,64],dtype="float")

    #Begin to Draw
    POS_VALUE=0.8
    NEG_VALUE=-0.8
    data[1:31,1]=POS_VALUE
    for i in range(1,11):
        data[i,i]=POS_VALUE
    for i in range(11,21):
        data[21-i,i]=POS_VALUE
    data[1:31,21]=POS_VALUE

    data[2,31:34]=POS_VALUE
    for i in range(0,7):
        data[i+2,31-i]=POS_VALUE
    data[8:25,25]=POS_VALUE
    for i in range(25,32):
        data[i,i]=POS_VALUE
    data[31,31:34]=POS_VALUE
    for i in range(34,41):
        data[65-i,i]=POS_VALUE
    data[8:25,40]=POS_VALUE
    for i in range(0,7):
        data[i+2,i+34]=POS_VALUE

    data[1:31,43]=POS_VALUE
    for i in range(1,11):
        data[i,43+i]=POS_VALUE
    for i in range(11,21):
        data[21-i,43+i]=POS_VALUE
    data[1:31,63]=POS_VALUE

    for i in range(37,44):
        data[i,i-11]=NEG_VALUE
    for i in range(37,44):
        data[i,64-i]=NEG_VALUE
    for i in range(44,57):
        data[i,i-23]=NEG_VALUE
    for i in range(44,57):
        data[i,89-i]=NEG_VALUE
    for i in range(37,44):
        data[i,i+2]=NEG_VALUE
    for i in range(37,45):
        data[i,77-i]=NEG_VALUE

    data[33:63,11]=NEG_VALUE
    data[33,9:14]=NEG_VALUE
    data[63,9:14]=NEG_VALUE

    data[33:57,47]=NEG_VALUE
    for i in range(57,64):
        data[i,i-10]=NEG_VALUE
    data[63,53:56]=NEG_VALUE
    for i in range(0,6):
        data[63-i,i+55]=NEG_VALUE
    data[33:58,61]=NEG_VALUE

    #SHOW THE MAP
    sns.heatmap(-data,xticklabels=False,yticklabels=False)
    show()

一枚Python数据工程师为妈妈写的几行代码
祝天下的妈妈们,母亲节快乐!(尤其我妈)

【转自慕课】https://www.imooc.com

Python

2018年Python开发者生态调查

2022-3-3 6:38:57

Python

pyinstaller打包exe文件太大,利用pipenv轻松解决

2022-3-3 6:41:25

搜索