我有一个CSV文件,其中包含整数(正数和负数),并希望创建1D热图(或热棒,如果存在).
到目前为止,这是我的代码:
import matplotlib as mat
import matplotlib.pyplot as plot
import numpy as np
import csv
a=([0,0])
a = np.resize(a,(1,96)) #the are 96 numbers from -56 to 40
with open('Start_0.csv') as csvfile:
reader = csv.reader(csvfile, delimiter = ';')
k = np.array(list(reader)) #read every row in the CSV
k = k.reshape((-1,7)) #every row has 7 data cells
for row in k:
i = int(row[4]) #i only need the fourth cell
if (i < 45)&(i > -50): #if the number is between …Run Code Online (Sandbox Code Playgroud)