Help csv data to tinydb or list

I have a data from a website thats being output to a csv file .

im grabbing like this :

blocks

i would like to put the data in a tinydb and update it every 10 min thats what my timer is set to .

my data looks like this

“device_id”,“type”,“bucket_step_minutes”,“timestamp”,“wind_lull”,“wind_avg”,“wind_gust”,“wind_dir”,“wind_interval”,“pressure”,“temperature”,“humidity”,“lux”,“uv”,“solar_radiation”,“precip”,“precip_type”,“strike_distance”,“strike_count”,“battery”,“report_interval”,“local_daily_precip”,“precip_final”,“local_daily_precip_final”,“precip_analysis_type”
80500,obs_st,null,1597173090,0,0,0,0,3,991,31.7,66,135470,5.15,1129,0,0,0,0,2.73,1,0,0,

this is my first time using this . any help would be appreciated .

tinydb a list or dictionary whatever would be easiest to search for a key later
and return its value

actually i can get more data from a json file over the web but it looks like this
and i have no idea where to start if i used it .

obs lines 0-19 are define like this :

1 Like

You can try list or csv ( can be converted easily to list )…Dictionaries must have key and value and your csv doesn’t have…You can store it as list then use select list item to slect the item you want by it’s index…
To convert csv to list use this block:
lists_from_csv_row

1st line of csv is the keys

“device_id”,“type”,“bucket_step_minutes”,“timestamp”,“wind_lull”,“wind_avg”,“wind_gust”,“wind_dir”,“wind_interval”,“pressure”,“temperature”,“humidity”,“lux”,“uv”,“solar_radiation”,“precip”,“precip_type”,“strike_distance”,“strike_count”,“battery”,“report_interval”,“local_daily_precip”,“precip_final”,“local_daily_precip_final”,“precip_analysis_type”

second line is the values for the keys

80500,obs_st,null,1597173090,0,0,0,0,3,991,31.7,66,135470,5.15,1129,0,0,0,0,2.73,1,0,0,0,0

Then you can store it as dictionary…You can see here:


i copied this little project and changed the json file to mine .

keep getting error

runtime

attached is project
test.aia (3.2 KB)

you can get the weather.json file from the assets .

this is how the file is served to me from the provider .
whats going on

a csv does not contain colons . comma separated values . many csv are exported the way mine is i have no control how the manufacture exports there data .

i just want to use the data .

im not a programmer . i just need a little help . thanks ahead .

ive been reading on the json file and i think that error is coming because its a nested json file … but i could be wrong .

1 Like

CSV basicly is a Comma-Seperated-Values…
It must be a comma seperated value…Else it won’t be a CSV…I will see your aia and i’ll try to help :+1:

1 Like

1 Like

that works . can you please walk me through your index logic so i can understand it …

also any way to turn that data into a dictionary now . when i try turning into dictionary i get stuck because of the formatting of the json with no values at some places .

thanks for your help

1 Like

Exercise of logical reasoning… Try it, you will make it

think i figured it . 1 and 2 or the first two sections of the json and 5 is the 5th . skipping the problemmatic 4th section that had no values and skipping the 3rd as it was not needed …

correct ?

so this includes data from all three sections or only the 5th

1- He gave you the solution.
2- Did you understand that it is the solution
3- Study what you received
4- Keep it as learning …

i know he gave me the solution … and i marked as so … but im trying to understand the solution
and asking you if what i wrote is the reason the solution works .

i dont know how else to word it .

will never learn if no one confirms what i suspect .

its like watching a video of something and repeating . monkey see monkey do …
if you dont understand it your still no better off .

i want to understand .

Again: read the solution, study it … it’s all you have to do to learn …

I’m not good in explaining how all this works so you would understand, but you can read from some links in post below…

First time playing with dictionary so I wouldn’t know exactly how to explain this either

1 Like

But , understanding the solutions , is part of learning, from him, who received the solution.

1 Like

thank you very very much .

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.