Click here to Skip to main content
15,399,440 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
{
"First Name": "Jonathan",
"Last Name": "Thomas",
"Marital Status": "married or civil partner",
"Sex": "Male",
"Age (Years)": 46,
"Height": 160,
}

I have a 600 row data set which I gave the first row.

import pandas as pd
df = pd.read_csv("user_data.csv")

df[df["Height"].isnull()].index.tolist()

On the code that I write using the pandas library. I want to re-write that code with the same logic code

Logic is: searching elements on the column and writing the missing one into the empty list

I want to use default libraries (os, sys, time, json, csv, …) instead of pandas that I used on up. Could you help and guide me?

What I have tried:

<pre lang="text">import pandas as pd
df = pd.read_csv("user_data.csv")

df[df["Height"].isnull()].index.tolist()

On the code that I write using the pandas library. I want to re-write that code with the same logic code

Logic is: searching elements on the column and writing the missing one into the empty list

I want to use default libraries (os, sys, time, json, csv, …) instead of pandas that I used on up. Could you help and guide me?
Posted
Updated 9-Nov-21 16:51pm
Comments
Richard MacCutchan 10-Nov-21 4:00am
   
The data you have shown is JSON not csv. Also, it is not clear exactly what you are trying to achieve.

1 solution

The content look like JSON object, not a line of CSV data.
If that is correct, have a look at https://pynative.com/python-parse-multiple-json-objects-from-file/[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900