hello I would like to know if it is possible to select only the values of my influx table, when I make a query in python it also extracts the date. or I would like to know how I can separate them within python to later create a dataframe.
this is what i have in my table.
name: va1
time value
1638023512567678902 1655.6
1638023518355667369 1655.6
1638023524074845230 1655.6
1638023529782981342 1655.6
i need to extract the values separately
Related
I'd like to automate the syntax. The number of variables varies from year to year. In one year the variable state occurs four times, in the next maybe six times.
I'd like to use something like WRITE OUTFILE to store a list containing the variable names and which I can call whenever needed.
Not sure how you can get a few variables called "state" in the same dataset?
In any case, if you want a list of the variables in your data saved as a new file, you can do this:
dataset declare ListOfVars.
oms /select tables /if commands=['File Information'] subtypes=['Variable Information']
/destination format=sav outfile='ListOfVars' .
display dictionary.
omsend.
dataset activate ListOfVars.
The new dataset ListOfVars has the list of your variables and their labels (and some other data).
Now just save the table to a new fine and keep whatever variables you need from it.
I'm currently working with Google Sheets to import data from Contact Form 7 in Wordpress. All the data is coming over fine, but I wanted to see about formatting it in more user friendly fashion. I've simplified the example a bit, but the gist of the form I have created allows the user to request multiple versions of a graphic file with different wording as needed, up to 5(my example has just 2 for simplicity sake).
All the data is imported using the CF7 variables and ideally I wanted to clean this up a bit. What I had thought of as a solution was creating a second sheet that pulls in this data submitted in the first sheet into a more user friendly format, as I intended to use this as a work form for a designer to create the requested graphic once the data is received. With each request the name/department/email/date all stay the same, but I'd like to display the version and line 1 and 2 data on another line. Is it possible to reorganize data like this on the fly, so when a new form is submitted and adds data to sheet 1, sheet 2 would then update with the properly formatted info?
Is this even possible to do? I did some looking online, but didn't anything that really related to this type of data manipulation.
Solution:
Here's what ended up working for my example
=ArrayFormula(QUERY({
Sheet1!A2:D,Sheet1!E2:G,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!H2:J,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!K2:M,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!N2:P,ROW(Sheet1!A2:A);
IFERROR(LEN(Sheet1!A2:D)/0),Sheet1!Q2:S,ROW(Sheet1!A2:A)
},"select Col1,Col2,Col3,Col4,Col5,Col6,Col7 where Col5<>'' order by Col8",1))
Yes, it's possible.
One way is to use arrays and the QUERY function.
For simplicity, let say that
Columns A and B have the general information of the order
Columns C and D have the data for version 1
Columns E and F have the data for version 2
Columns G and H have the data for version 3
On the output sheet, add the headers.
Below of them add a formula like the following:
=ArrayFormula(QUERY({A2:B,C2:D,ROW(A2:A);IFERROR(LEN(A2:B)/0),E2:F,ROW(A2:A);IFERROR(LEN(A2:B)/0),G2:H,ROW(A2:A)},"select Col1,Col2,Col3,Col4 where Col3<>'' order by Col5"))
References start on row 2 to skip the headers to avoid to include them on the output sheet.
ROW(A2:A) is used to keep the order
IFERROR(LEN(A2:B)/0) is a "trick" used to "hide" the order (general information) data for the second and following rows for the same order. On the select parameter of the QUERY function, it's referrey as Col5 on the order by clause.
It's assumed that lookup-choice-1 will never be empty.
NOTES:
If more columns were added, the column numbers should be updated accordingly
Don't use the order by clause to sort the result by the general information columns because the "trick" to hide the "labels". If you need to apply a sort, do it' before applying the above formula, you could do this by sorting the source range through the Data > Sort range... feature, so the data is sorted before it's transformed by the above formula.
See also
Sort and filter your data, an official help article describing Data > Sort range...
Currently, we are getting stream of data from message queue, which contains multiple information. One of which is created and updated timestamp of a certain event in epoch format.
{"ip":"1.1.1.1","name":"abc.com","createtime":1500389719832,"updatetime":1500613413164 },{"ip":"1.1.1.2","name":"xyz.com","createtime":1500389719821,"updatetime":1500613413233}
Currently, my code will consume messages from queue and pushes all data to Neo4j as bulk. There would be 1000's of rows like this. Each field in this data is stored in neo4j as individual property keys. When a user selects a date from UI, my intention here is to get all the "name" values from that specific date and display only those records in the UI. As the user would select the date which would be in MM/DD/YYYY format, whats the best option to only compare the user selected date with "createtime" thats in epoch format? My thinking is to convert the "createtime" into MM/DD/YYYY readable format and store only the date portion as a separate neo4j property maybe newCreateTime, but i am not sure how to convert only the createtime and updatetime from entire stream of data. Can someone throw some light on this?
You can use the APOC function apoc.date.format to set the newCreateTime properties.
For example (assuming your data is stored in nodes with the Info label):
MATCH (i:Info)
SET i.newCreateTime = apoc.date.format(i.createTime, 'ms', 'MM/dd/yyyy');
I am just starting with influxdb as a time series database and i was trying to create some measurements, however it seems like influx automatically determines which fields of the measurements are tags and which are fields, is there any way to force one or another at insertion time (first insertion of a measurement)?? or any other way whatsoever?
No, InfluxDB won't automatically determine which are fields and which are tags. Your "insert string" structure "helps InfluxDB in determining which are tags and which are fields.
For example:
cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000
In this string, "cpu_load_short" is the measurment name (observe that there is no = sign to form a key/value pair), followed by semi colon.
host=server01,region=us-west are tags (in key value formats)
Rignt after tags you can see that there is space, which tells following the space are "Fields".
You may refer this documentation for more information.
I am trying to store Dates on my nodes on the database. I am loading data using webadmin and the csv importer, my problem is that data is saved as string and i need it to be long, i have found some methods to cast some types like toInt() but there is no equivalent for long type.
I have a node that contains two date fields, ArrivalDate and DepartureDate, it is a long number in the csv file but once the query is executed in neo4j the field is stored as a string. The problem is that i cannot make a query to compare Dates since they are strings, a sample query i want to run is like this:
match(p:Person)--(s:Stay)
where (s.ArrivalDate)<=634924360000000000 and s.DepartureDate>=634924360000000000)
So i would get all the people staying in that Date.
I have done some research, and also asked before here, maybe the question was not that good explained.
For references: i am using the webadmin to load csv files for the bulk load but then my app is in c# and i am using neo4jclient to work with the DB.
Neo4j 2.1 (which is about to release rather soon) has a Cypher command LOAD CSV. You can use toInt function to convert a string to a numeric value during import. Example:
LOAD CSV WITH HEADERS FROM 'file:/mnt/teamcity-work/42cff4ac2707ec23/target/community/cypher/docs/cypher-docs/target/docs/dev/ql/load-csv/csv-files/file.csv'
AS line
CREATE (:Artist { name: line.Name, year: toInt(line.Year)})