【问题标题】:How to use pandas chunk for large data into split the data for x_train and y_train for machine learning?如何使用 pandas 的大数据块将数据拆分为 x_train 和 y_train 进行机器学习?
【发布时间】:2021-07-25 19:01:08
【问题描述】:

df_chunk=pd.read_csv(文件名,chunk=1000) X_train,Y_train,X_test,Y_test=train_test.split(df_chunk)

如何使用 df_chunk 将其拆分为 x 和 y 训练数据

【问题讨论】:

    标签: pandas machine-learning


    【解决方案1】:

    我以前从未遇到过这种情况。也许你可以试试这个。

    https://examples.dask.org/machine-learning/incremental.html

    或者,这个。

    https://zerowithdot.com/splitting-to-batches/

    或者,获取原始数据集的一小部分。如果它真的是随机的,那么一个样本应该能够很好地代表整个数据集。

    # Fraction of rows
    # here you get .50 % of the rows
    df.sample(frac = 0.5)
    

    【讨论】:

      猜你喜欢
      • 2021-02-15
      • 2018-04-29
      • 2021-07-24
      • 2019-06-17
      • 2017-12-15
      • 2021-01-13
      • 2021-06-02
      • 1970-01-01
      • 2013-06-07
      相关资源
      最近更新 更多