So I'm creating an app to go through one table to collect and change some data, then move the updated information to the new table. The issue I'm running into is the types of columns. I ran into copying a timestamp that has Infinity instead of timestamp. When I try to enter the data in the file, I get the following message:
column "infinity" does not exist
Any ideas on what I should be using here?
Query: insert into schema.table (id,time,processed,in,out) values ('828h29s2838','Tue, 01 Feb 2020 08:58:22 GMT',false,'Tue, 01 Feb 2020 08:58:22 GMT',infinity);
data in table:
828h29s2838 | 2020-02-01 00:58:22.418 | false | 2020-02-0 00:58:22.455 | infinity
Oh, I got it now. I should have placed apostrophes around infinity in my query.
corrected query: insert into schema.table (id,time,processed,in,out) values ('828h29s2838','Tue, 01 Feb 2020 08:58:22 GMT',false,'Tue, 01 Feb 2020 08:58:22 GMT','infinity');
Related
I'm trying to write an Excel function to grab the value of the Running Total in rows that are on the first of the month in the Date column. Where there are more rows with the same date, I want to grab the last value. (The dates are in ascending order.)
This is an example of the kind of table I'm using:
Income
Running Total
Date
$1,000.00
$1,000.00
Jun 30, 22
-$60.00
$940.00
Jul 01, 22
-$42.00
$898.00
Jul 20, 22
-$55.00
$843.00
Aug 01, 22
-$200.00
$643.00
Aug 01, 22
-$60.00
$583.00
Aug 19, 22
-$20.00
$563.00
Sep 01, 22
$334.00
$897.00
Sep 10, 22
-$610.00
$287.00
Oct 01, 22
-$50.00
$237.00
Oct 02, 22
I have a formula for calculating the running total and the date is created with the DATE() function.
I'm planing to use the function in a new table on the same sheet. In each row is the running total of the first of that month.
Month
Amount
Jul
Aug
Sep
Oct
The problem is that I'm expecting this table to grow and I don't want to manually search each row. I would like to have a function that goes through the Date column and identifies if it contains the date of the first day of the month, if it does, get the running total.
I have attempted something like this:
=CONCAT("$B",MATCH(”Jul 01, 22”,$C1:$C100,1))
But I don't know how to create the function or whether or not this works.
How can I write a function that grabs the Running Total on the first of the month?
You can use either INDEX() & MATCH() or XLOOKUP()
• Formula used in cell F2
=INDEX($B$2:$B$11,MATCH(DATE(2022,MONTH(E2&1),1),$C$2:$C$11,1))
Or,
• Formula used in cell H2
=XLOOKUP(DATE(2022,MONTH(E2:E5&1),1),C2:C11,B2:B11,,1,-1)
or, can exclude the 5th parameter, of XLOOKUP() as well
• Formula used in cell H2
=XLOOKUP(DATE(2022,MONTH(E2:E5&1),1),C2:C11,B2:B11,,,-1)
I will try to keep this as simple as possible and cause no confusion.
I have over 35,000 rows and 15 columns of data but I am going to provide a very simple case of what I am trying to do.
Basically, I want to sort my dates in column A in ascending order, but then also have the data corresponding to a date sorted to "follow" it to its new row location. I want this to be done using VBA code.
Simple Case
Raw Data
Column A Column B
Jan 5 15
Jan 3 45
Jan 1 7
Jan 10 12
Jan 7 30
Expected Sorted Data
Column A Column B
Jan 1 7
Jan 3 45
Jan 5 15
Jan 7 30
Jan 10 12
I have looked all over and can not find a good way to do this. Any and all help will be greatly appreciated. Thanks!
I have code that creates a bokeh datatable from an oracle sql query converted into a dataframe df. The original query result looks like this:
User | Entry | feature1 | feature2
jim JAN 1 22
jones JAN 1 93
ted FEB 0 93
I want to return the count of Entry for each User only. Then I want to sum entries for each user in a column called 'YEARLY_TOTAL' So I do:
del df['feature1']
del df['feature2']
df=df.pivot_table(index=['User'], columns=['Entry'], aggfunct=len)
df=df.reset_index()
df['YEARLY_TOTAL']=df.sum(axis=1)
source=ColumnDataSource(data=dict())
Now it looks like:
User JAN FEB YEARLY_TOTAL
jim 1 1
jones 1 1
ted 1 1
I attempt to render it in a bokeh server datatable with adjustable slider via:
def update():
current=df[(df["YEARLY_TOTAL"]>=slider.value[0]) & (df["YEARLY_TOTAL"]<=slider.value[1])]
source.data={
'User': current.User,
'January':current.Jan,
'February':current.Feb,
'Total':current.YEARLY_TOTAL,}
slider=RangeSlider(title="Yearly Total", start=0, end=1000000, value=(0,5000), step=10000)
slider.on_change('value', lambda attr, old, new: update())
columns=[TableColumn(field="User", title="User"),
TableColumn(field="Jan", title="January"),
TableColumn(field="Feb", title="February"),
TableColumn(field="Total", title="Total")]
data_table=DataTable(source=source, columns=columns, width=800)
controls=widgetbox(slider)
table=widgetbox(data_table)
curdoc().add_root(row(controls, table))
update()
The table renders in the browser, but there is no data in the table. Interestingly enough, if I save the pivoted dataframe to csv, and pass the csv to render the table (after commenting out the pandas transformations as they are no longer necessary), the datatable renders fine. What is happening?
In the oracle sql, I made a date transformation that ended up appending spaces to the end of 'Jan' and 'Feb'. I won't make the same mistake again!
i'm trying to create a small spreadsheet for data verification.
Below i have created two tables Table 1 and Table 2.
What i am trying to find is a simple =Index Match or similar to check for Current month then copy that value to respective Group row under verification.
Problem is that the months are a header row and i have no idea how to check a header row for correct month then output the values in the cells below it to each corresponding group in the output list.
So to put it in programming terms this is what im looking for
If A2=Table2[Header] then c8=C4 else table[header] + step right
A2 contains todays Date (=today()) and Header has the shorten Month names as Jan Feb Mar and so on.
Something similar as above, i don't know if i'm making it harder for me then it really should be. I'm working with Excel 2013.
Output list
Group Input Verification Differance
G1 120 123 =Sum([#[Input]]-[#[Verification])
G2 76 110 =Sum([#[Input]]-[#[Verification])
G3 110 90 =Sum([#[Input]]-[#[Verification])
G4 34 53 =Sum([#[Input]]-[#[Verification])
Data list
Group Year Jan Feb Mar Apr
G1 2017 123 95 80
G2 2017 110 85 75
G3 2017 90 80 70
G4 2017 53 53 46
Regards
Johan
You would use a second match to find the correct column:
=INDEX(DataList,MATCH([#Group],DataList[Group],0),MATCH(TEXT($A$1,"mmm"),DataList[#Headers],0))
I have an RFC1123 Date string, such as: 'Mon, 01 Jan 0001 00:00:01 GMT'
I want to parse this string into a Date in NodeJS. I assumed that new Date('Mon, 01 Jan 0001 00:00:01 GMT') would achieve what I wanted... but it doesn't. When I inspect the content of the resultant Date I see that .toUTCString() gives Mon, 01 Jan 2001 00:00:01 GMT.
I am at a loss as to how the parsing function determined that the year was 2001.
What's even more bizarre is that if I use ISO8601 format instead, and do: new Date('0001-01-01T00:00:01Z').toUTCString() I get Mon, 01 Jan 1 00:00:01 GMT -- exactly what I would expect -- yet if I then do new Date('Mon, 01 Jan 1 00:00:01 GMT') I still get the year as 2001.
Note: I can process these same strings in another language (C#) and I get exactly what I would expect.
Anybody have any suggestions for how to correctly deserialize RFC1123 Date's in NodeJS? If the date is "new" (i.e. above the year 1000) things seem to work okay, but "old" dates seem broken, or else I'm missing something "extra" which is required for older dates.
edit: It looks like technically the RFC 1123/2822 format has a lower bound of the year 1900 -- although Date allows us to go below that so I am not sure what's stopping it from supporting years <100.
You could use moment.js to parse the date:
var dateFormat = 'ddd, DD MMM YYYY HH:mm:ss',
dateString = 'Mon, 01 Jan 0001 00:00:01 GMT';
var dateTime = moment.utc(dateString, dateFormat);