意外と見当たらなかったので作りました。
グレースケール画像のリサイズと同じことしてます
CSVをリサイズして返す関数
from PIL import Image
from glob import glob
import numpy as np
import os
def resize_csv(file, width, height):
original = np.loadtxt(file, delimiter=",")
img = Image.fromarray(original)
resized_img = img.resize((width, height))
return np.array(resized_img)
def resize_all_csv(folder, width, height):
files = glob(folder + "*")
for file in files:
basename = os.path.basename(file)
ext = os.path.splitext(basename)[-1]
if not ext == ".csv":
continue
resized = resize_csv(file, width, height)
np.savetxt(yourefolderandnamehere, resized, delimiter=',')