63299161

Date: 2020-08-07 10:46:06
Score: 4
Natty:
Report link

You can use pandas to read your csv with chunksize argument as described here (How can I partially read a huge CSV file?)

import pandas as pd



#Function that you want to apply to you arguments

def fn(A, B, C, D):

    print(sum(A), sum(B), sum(C), sum(D))



#Iterate through the chunks

for chunk in pd.read_csv('test.csv', chunksize=3):

    #Convert dataframe to dict

    chunk_dict = chunk.to_dict(orient = 'list')

    #Pass arguments to your functions

    fn(**chunk_dict)

Reasons:
  • Blacklisted phrase (1.5): How can i
  • Blacklisted phrase (1): stackoverflow
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: perlusha