Pandas: Filter rows on value in dictionaries in Series

Advertisements Some columns in my dataframe consist of dictionaries themselves, like this dataframe: df = pd.DataFrame({‘Name’: [‘Alice’, ‘Bob’, ‘Aritra’], ‘Age’: [25, 30, 35], ‘Location’: [ {‘City’: ‘Seattle’, ‘State’: ‘WA’}, {‘City’: ‘New York’, ‘State’: ‘NY’}, {‘City’: ‘Albany’, ‘State’: ‘NY’} ] }) df Name Age Location 0 Alice 25 {‘City’: ‘Seattle’, ‘State’: ‘WA’} 1 Bob 30 {‘City’:… Read More Pandas: Filter rows on value in dictionaries in Series

Create nested object from list of objects

Advertisements Is it possible to parse through this list and create a new nested object for every sensor after "RECORD". { "TIMESTAMP": "2022-10-21 13:55:00", "RECORD": "0", "Sensor1": "1.654", "Sensor2": "1.176", "Sensor3": "0.706" } Result: { "Sensor1": { "TIMESTAMP": "2022-08-21 13:55:00", "Value": "1.654" }, "Sensor2": { "TIMESTAMP": "2022-08-21 13:55:00", "Value": "1.176" }, "Sensor3": { "TIMESTAMP": "2022-08-21… Read More Create nested object from list of objects

How to change the values of user-inputted strings that act as keys in a nested dictionary pulled from a JSON

Advertisements I’m sorry for the crazy title. I’m new to programming and have no idea what I’m doing. I’m making a weight tracker that saves data to a JSON. The data is a nested dictionary that supposed to look like: { "Dates": { "11/11/11": { "Morning": 500, "Night": 502 } } } I’ve been trying… Read More How to change the values of user-inputted strings that act as keys in a nested dictionary pulled from a JSON