list

Extracting information from a list of json Python

Extracting information from a list of json Python Question: Identifier Properties 1 [{"$id":"2","SMName":"pia.redoabs.com","Type":"sms"},{"$id":"3","Name":"_18_Lucene41_0.doc","Type":"file"}] 2 [{"$id":"2","SMName":"pred.redocad.com","Type":"sms"},{"$id":"3","Name":"_18_Nil41_0.doc","Type":"file"}] 3 [{"$id":"2","SMName":"promomaster.com","Type":"sms"},{"$id":"3","Name":"_17_Litre41_0.doc","Type":"file"}] 4 [{"$id":"2","SMName":"admaster.com","Type":"sms"},{"$id":"3","Name":"_k.pos","Type":"file"}] 5 [{"$id":"2","SMName":"plan.com.com","Type":"sms"},{"$id":"3","Name":"_3_Lucene41_0.doc","Type":"file"}] This is a dataframe with 2 columns "Identifier" & "Properties"> The "Properties" column appears as a list of json.The aim is to create 2 different columns for "sms" & "file". Tried json_normalize to create …

Total answers: 1

Remove empty strings from a list of strings on each row in a pandas dataframe

Remove empty strings from a list of strings on each row in a pandas dataframe Question: I have a pandas dataframe and one of the columns contains a list of strings e.g: [”, ‘Hello’, ‘The house is warm’, ”, ‘What time is it’] The strings are different for each row of the dataframe but all …

Total answers: 1

Simplify Python array retrieval of values

Simplify Python array retrieval of values Question: I have the following code at the moment which works perfectly:- my_array = [ [‘var1’, 1], [‘var2’, 2], [‘var3’, 3], [‘var4’, 4], [‘var5’, 5] ] for i in range(len(my_array)): if my_array[i][0] == "var1": var_a = my_array[i][1] elif my_array[i][0] == "var2": var_b = my_array[i][1] elif my_array[i][0] == "var3": var_c …

Total answers: 1

Print nested list in a particular way

Print nested list in a particular way Question: I have this list: top_list = [[‘Recent news’, ’52’, ‘15.1’], [‘Godmorning’, ‘5’, ‘1.5’], [‘Sports news’, ’47’, ‘13.7’], [‘Report with weather’, ’34’, ‘9.9’], [‘The angel and the lawless’, ’33’, ‘9.6’], [‘Thundercats’, ‘3’, ‘0.9’], ["Mother’s legacy", ‘3’, ‘0.9’], [‘UR: Summer evenings with Europe of the Times’, ‘3’, ‘0.9’], [‘Tip’, …

Total answers: 1

Count nodes sharing row or column with at least one other node

Count nodes sharing row or column with at least one other node Question: I have a grid of nodes (represented by ones). I would like to quickly and simply (in a way that is both readable and fast) count the number of nodes that share a column or row with another node. Here is my …

Total answers: 1

How to sort this list to make the exponent value go first?

How to sort this list to make the exponent value go first? Question: Given list = [10, ‘3 ^ 2’, ‘2 ^ 3’], how to sort the list to make the exponents values ( ‘3 ^ 2’ and 2 ^ 3 ) are before any integer / float value and exponent values are sorted from …

Total answers: 1

How to edit and delete keys and values in python dict

How to edit and delete keys and values in python dict Question: i have a little problem that needs solving, i have to write a program that saves contacts in a dict and be able to 1- add new contacts 2- delete contacts 3- edit contacts 4- list contacts 5- show contacts i wrote a …

Total answers: 1