How to resolve this error in weka? - weka

While giving input to ![weka][1] using my training set i get the following error :
Wrong number of values .Read 12,expected 4, Read token [EOL] line 3.
A sample data set :
insert,into,(name.email.comment),values,('test'.'test1'.'test2')--,'anything','anything'),no
insert,into,(name.email),values,('parameter1'.'parameter2')--),'anything',no

Related

Conditioned Latin Hypercube doesn't work on raster data in clhs::clhs R

I am attempting to use the clhs::clhs() function to perform conditioned Latin Hypercube Sampling in R. I want to use a raster as the existing ancillary data from which to construct the Latin Hypercube. Furthermore, I wish to use the C++ implementation of clhs() to improve speed. However, when I run the code accordingly, I get the following error:
Error in CppLHS(xA = dat, cost = costVec, strata = continuous_strata, :
Not a matrix.
If I try to convert the data to a matrix, I get the following error:
Error in UseMethod("clhs") :
no applicable method for 'clhs' applied to an object of class "c('matrix', 'array', 'double', 'numeric')"
Finally, I tried to use the backend implementation CppLHS(), but that also threw an error:
Error in CppLHS(x = as.matrix(rst), size = 60, use.cpp = TRUE) :
could not find function "CppLHS"
How can I get clhs() to run on a raster? Any guidance would be much appreciated. Here is the full reproducible example:
library(raster)
library(clhs)
rst<-raster(ncol=100, nrow=100, ymx=45.2, ymn=45.1, xmx=-118.5, xmn=-119.0, crs="+init=epsg:2992")
values(rst)<-rnorm(10000, 50, 3)
m.include<-sample(c(1:10000), 50, replace=FALSE)
clhs(x=rst, size=100, use.cpp=TRUE)
clhs(x=as.matrix(rst), size=100, use.cpp=TRUE)
CppLHS(x=rst, size=100, use.cpp=TRUE)

How to remove error records from a Dynamic dataframe in AWS glue?

I have a dynamic dataframe which contains error records.Please find the code below.
val rawDataFrame = glueContext.getCatalogSource(database = rawDBName, tableName = rawTBLName).getDynamicFrame();
println(s"RAW_DF-----count: ${rawDataFrame.count} errors: ${rawDataFrame.errorsCount}")
The above print statement prints as below.
RAW_DF-----count: 168456 errors: 4
I need to create a dynamic data frame which contains only 168456 records and I need to eliminate 4 error records.Kindly help.
Error records are not converting to Spark's DataFrame so try to transform your DynamicFrame to df and back:
val noErrorsDyf = DynamicFrame(rawDataFrame.toDF(), glueContext)

How to change time format in NetBeans template

I have a very specific C++ project, and I use a NetBeans.
Reason for it is because we need to have a specific timestamps, and I found NetBeans templates a great tool for inserting an automatic header with all the relevant stuff.
I manage set everything up nicely, but I can't figure out how to set up the time format in the header template.
Currently it shows this:
Created on April 6, 2017, 2:18 PM
But since I work in Central Europe, I need a 24h hour format so I could have something like
Created on 06.04.2017. at 14:18
I found on how to change a date format here, but it doesn't work for times for some reason.
I even tried with using FreeMaker's template language reference, so I created a variable time that looks like this:
<#assign dateTime = .now>
<#assign time = dateTime?time>
${time?iso("Europe/Zagreb")}
But it still didn't change anything.
Now my template looks like this:
// -*- C++ -*-
<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#assign aDateTime = .now>
<#assign time = aDateTime?time>
<#include "${project.licensePath}">
/*
* File: ${NAME}.${EXTENSION}
* Author: ${user}
*
* Created on ${DATE} at ${time?iso("Europe/Zagreb")}
*/
#ifndef ${GUARD_NAME}
#define ${GUARD_NAME}
#endif /* ${GUARD_NAME} */
Is this possible to be changed at all, and how?
Any help is appreciated.
In your question you link a resource (THANKS for that!!!) suggesting the following for dates:
${date?date?string("dd.MM.yyyy")}
I tried the same for time and it works well:
${time?time?string("HH.mm.ss")}
BTW I also tried producing some errors and got some nice error messages stating what NB expects and what it gets pretty clearly:
${date?time?string("hh.mm.ss")}
${time?date?string("hh.mm.ss")}
${time?datetime?string("hh.mm.ss")}
${date?datetime?string("hh.mm.ss")}
produced:
Error: on line 20, column 6 in Templates/Classes/Class.java
The string doesn't match the expected date/time format. The string to parse was: "11-Jan-2018". The expected format was: "HH:mm:ss".
Error: on line 21, column 6 in Templates/Classes/Class.java
The string doesn't match the expected date/time format. The string to parse was: "13:40:27". The expected format was: "dd-MMM-yyyy".
Error: on line 22, column 6 in Templates/Classes/Class.java
The string doesn't match the expected date/time format. The string to parse was: "13:40:27". The expected format was: "dd-MMM-yyyy HH:mm:ss".
Error: on line 23, column 6 in Templates/Classes/Class.java
The string doesn't match the expected date/time format. The string to parse was: "11-Jan-2018". The expected format was: "dd-MMM-yyyy HH:mm:ss".

Impala with Sas 9.4 : not import data with create table

creating a table with Sas and Impala I can't import data with many columns (more than 1500). The table is created but the data is not written and the following error is generated:
ERROR: CLI execute error: [Cloudera][ImpalaODBC] (110) Error while executing a query in Impala:
[HY000] : AnalysisException: Syntax error in line 1: ...,xxx`) VALUES ( ? , ? , ? , ? , ? , ? , ? , ...
^ Encountered: Unexpected character Expected: CASE, CAST, DEFAULT, EXISTS, FALSE, IF, INTERVAL, NOT, NULL, TRUNCATE, TRUE, IDENTIFIER
Thank you
I try to create a view or a table with engine SAS Impala (ODBC impala ClouderaImpalaODBC-2.5.36.1009-1.x86_64) RedHat 6.8. And I get this error:
ERROR: CLI execute error: [Cloudera] [ImpalaODBC] (110) Error while executing a query in Impala: [HY000]: AnalysisException: Syntax
error in line 1: ... King ((a.trns_dt between {d '31.10.2015'} and {d '^ 2 ... Encountered:
Unexpected character Expected: CASE, CAST, EXISTS, FALSE, IF, INTERVAL, NOT NULL, TRUNCATE, TRUE, IDENTIFIER Caused BY:
Exception: Syntax error
We have seen that characters that are passed impala can not read such. "{}".

TypeError when inserting time into xlsxwriter

I'm importing two points of data from MySQLdb. The second point is a time which cursor.fetchall() returns as a timedelta. I had no luck trying to insert that info into xlsxwriter, always getting a "TypeError: Unknown or unsupported datetime type" error.
Ok... round 2
Now I'm trying to convert the timedelta into a datetime.datetime object:
for x in tempList:
timeString = str(x[1])
ctTime.append(datetime.datetime.strptime(timeString,"%H:%M:%S))
Now in xlsxwriter, I setup formatting:
ctChart.set_x_axis({'name': 'Time', 'name_font': {'size': 14, 'bold': True}, 'num_font': {'italic': True},'date_axis': True})
And then I create a time format:
timeFormat = workbook.add_format({'num_format': 'hh:mm:ss'})
Then I attempt to insert data:
ctWorksheet.write_datetime('A1',ctTime,timeFormat)
But no matter what I do, no matter how I format the data, I always get the following error:
TypeError: Unknown or unsupported datetime type
Is there something stupidly obvious I'm missing?
******* EDIT 1 *******
jmcnamara - In response to your comment here are more details:
I've tried using a list of time deltas such as datetime.timedelta(0, 27453) which when printed is 7:37:33 using the following code:
timeFormat = workbook.add_format({'num_format': 'hh:mm:ss'})
ctWorksheet.write_datetime('A1',ctTime,timeFormat)
I still get the error: TypeError: Unknown or unsupported datetime type
Even iterating through the list and attempting to insert the results fails:
timeFormat = workbook.add_format({'num_format': 'hh:mm:ss'})
i = 0
for t in ctTime:
ctWorksheet.write_datetime(i,0,t,timeFormat)
i += 1
I finally got it working with my most recent code. The chart still isn't graphing correctly using the inserted times, but at least they are inserting correctly.
Since I was pulling the timedeltas from SQL, I had to change their format first. Raw timedeltas from SQL just weren't working:
for x in templist:
timeString = datetime.datetime.strptime(str(x[1]),"%H:%M:%S")
ctTime.append(timeString)
With those datetime.strptime formatted times I was able to then successfully insert into the worksheet.
timeFormat = workbook.add_format({'num_format': 'hh:mm:ss'})
i = 0
for t in ctTime:
ctWorksheet.write_datetime(i,0,t,timeFormat)
i += 1
The GitHub master version of XlsxWriter supports datetime.timedelta.
Try it out and let me know if it works. It will probably be uploaded to PyPI in the next week.