Hello, I'm seeking some suggestions for the issue below:
Suppose I have multiple CSV files which including header.
ID,NO,Date
1,200,2020-02-03
...........................
...........................
.........................
How can I process the CSV files so that each line of one CSV file will map to one object and then send N objects to an api by making rest api call?

A few issues here:

  1. No code offered so no one can see your approach.
  2. What API? There are so many.
import os
import glob
import pandas as pd
import numpy as np

file_path = "/Users/A/Desktop/bHistory/"
read_files = glob.glob(os.path.join(file_path, "*.csv"))

np_array_values = []
for files in read_files:
    b_history = pd.read_csv(files,header=0)
    np_array_values.append(b_history)
    files
    merge_values = np.vstack(np_array_values)
    b_history = pd.DataFrame(merge_values)
    b_history.columns = ['B','No','Date']
    print(b_history)
    #each row re-presents one object.
    #For example each row map to History object in java web api contains 3 parameters as B, No and Date
    #process per csv file, map to java object History which have 3 parameters as (B, No   and Date), then send to the api through endpoint(post call)

    #example here
    # But I'm not sure how to map the each row to java object.
    def add_task(history):
    return requests.post(_url('/tasks/'), json={
        'history': history
        })
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.