Home>

The title is still a simple question.
Use pandas only when batch importing csv data from a file or only for output after processing
Isn't it awkward to personally store in a numpy array when importing into variables?

import numpy as np
import pandas as pd
a = np.array (pd.read_csv ("hoge.csv"))
#Do processing
a = pd.DataFrame (a)
a.to_csv ("hoge_out.csv")
  • Answer # 1

    >Is it a bad way to store in a numpy array personally?

    The royal road.

  • Answer # 2

    Simple things can be done with just numpy, so it will be more beautiful.

    numpy.loadtxt — NumPy v1.17 Manual
    numpy.savetxt — NumPy v1.17 Manual

    If you want to do more complicated preprocessing, you can read it with pandas and process it on it. The policy of preprocessing as quickly as possible and handling with numpy arrays is subtle in exploratory data analysis and visualization, but I think that it is possible to implement a machine learning model.