I want to convert all the rows into array.
E.g. I have multiple values which is stored in CSV.
Suppose in A1 position value is Message
In B1 position value is Field=1234
In C1 position value is Field=0023
Like from A1 to around AZ1 I have data in rows.
So I want to convert it into array after that stored in postgres by different data fields.
In my csv there is no any column name.
I’m expecting the python code for this.
After that I want to catch only particular data fields value to created column names.
This is my data which is stored like this in csv. So, I want to segregate this data in database.
My CSV Data:- My data
I want to segregate like this in database from csv file:- Segregate like this in & store in database
2
Answers
You can use pandas for this. For Example
first you can read the data from csv. In the above example I just created a simple DataFrame. After that use iloc method to select the specific row. and then just append it in the array. Remember that index starts from 0 so 3 here indicates the 4th row.
Output: