简体   繁体   中英

What to use instead of csv2rec

According to the documentation matplotlib.mlab.csv2rec is deprecated, but the message doesn't indicate what we should move to instead. This is an extremely useful function that keeps my scripts short, I don't want to go rewrite all of this by hand. What should I replace this with?

https://matplotlib.org/api/mlab_api.html#matplotlib.mlab.csv2rec

I've been able to get by with the following workaround:

import numpy as np
def csv2rec(filename):
    return np.recfromtxt(filename, dtype=None, delimiter=',', names=True, encoding='utf-8')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM