Pandas: from_csv gives error - python-2.7

I use Pandas 0.12.0 and definded a read csv function as follows:
df=pandas.DataFrame.from_csv(inputpfad,index_col=2, parse_dates=[0,5],
infer_datetime_format=True)
However, I got as error message:
TypeError: from_csv() got an unexpected keyword argument 'infer_datetime_format'
I set it to true to speed up the parsing. Might it not be supported
in my Pandas-version?

Related

Failed to load pre trained onnx models in OpenCV C++

This is my first time with ONNX models and I’m not sure if I’m having a newbie problem so sorry in advance!
I’ve just tried to load a couple of models and I have the same assert always:
[ERROR:0#0.460] global onnx_importer.cpp:1054 cv::dnn::dnn4_v20221220::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 3 inputs and 1 outputs: [Concat]:(onnx_node!Concat_2) from domain='ai.onnx'
OpenCV: terminate handler is called! The last OpenCV error is:
OpenCV(4.7.0-dev) Error: Unspecified error (> Node [Concat#ai.onnx]:(onnx_node!Concat_2) parse error: OpenCV(4.7.0-dev) C:\GHA-OCV-2\_work\ci-gha-workflow\ci-gha-workflow\opencv\modules\dnn\src\layers\concat_layer.cpp:105: error: (-215:Assertion failed) curShape.size() == outputs[0].size() in function 'cv::dnn::ConcatLayerImpl::getMemoryShapes'
> ) in cv::dnn::dnn4_v20221220::ONNXImporter::handleNode, file C:\GHA-OCV-2\_work\ci-gha-workflow\ci-gha-workflow\opencv\modules\dnn\src\onnx\onnx_importer.cpp, line 1073
Both models come from https://github.com/PeterL1n/RobustVideoMatting and they are “rvm_resnet50_fp32.onnx” and “rvm_mobilenetv3_fp32.onnx”
Obviously I’m loading them with
robustNN = cv::dnn::readNetFromONNX(robustNNPath);
Thank you in advance for any tip!

BigQuery - Where can I find the error stream?

I have uploaded a CSV file with 300K rows from GCS to BigQuery, and received the following error:
Where can I find the error stream?
I've changed the create table configuration to allow 4000 errors and it worked, so it must be a problem with the 3894 rows in the message, but this error message does not tell me much about which rows or why.
Thanks
I'm finally managed to see the error stream by running the following command in the terminal:
bq --format=prettyjson show -j <JobID>
It returns a JSON with more details.
In my case it was:
"message": "Error while reading data, error message: Could not parse '16.66666666666667' as int for field Course_Percentage (position 46) starting at location 1717164"
You should be able to click on Job History in the BigQuery UI, then click the failed load job. I tried loading an invalid CSV file just now, and the errors that I see are:
Errors:
Error while reading data, error message: CSV table encountered too many errors, giving up. Rows: 1; errors: 1. Please look into the error stream for more details. (error code: invalid)
Error while reading data, error message: CSV table references column position 1, but line starting at position:0 contains only 1 columns. (error code: invalid)
The first one is just a generic message indicating the failure, but the second error (from the "error stream") is the one that provides more context for the failure, namely CSV table references column position 1, but line starting at position:0 contains only 1 columns.
Edit: given a job ID, you can also use the BigQuery CLI to see complete information about the failure. You would use:
bq --format=prettyjson show -j <job ID>
Using python client it's
from google.api_core.exceptions import BadRequest
job = client.load_table_from_file(*args, **kwargs)
try:
result = job.result()
except BadRequest as ex:
for err in ex.errors:
print(err)
raise
# or alternatively
# job.errors
You could also just do.
try:
load_job.result() # Waits for the job to complete.
except ClientError as e:
print(load_job.errors)
raise e
This will print the errors to screen or you could log them etc.
Following the rest of the answers, you could also see this information in the GCP logs (Stackdriver) tool.
But It might happen that this does not answer your question. It seems like there are detailed errors (such as the one Elliot found) and more imprecise ones. Which gives you no description at all independently of the UI you're using to explore it.

Redshift COPY from S3 fails when timestamp is not correct

While loading data into Redshift from S3 via the COPY command, if any record in the file contains an incorrect timestamp, then the copy fails. I have passed maxerror as 1000 to the COPY command, but still it fails.
However, upon subsequent retries, the same command works. Though it fails to load the corrupted records.
This is the error I am getting:
ERROR: Assert
DETAIL:
-----------------------------------------------
error: Assert
code: 1000
context: status == 0 - timestamp: '-6585881136298398395'
query: 30903
location: cg_util.cpp:1063
process: query1_69 [pid=25674]
-----------------------------------------------
AWS cli version : aws-cli/1.10.56 Python/2.7.12 Linux/4.4.19-29.55.amzn1.x86_64 botocore/1.4.46
Is there anyone who faced the same issue? How did you resolve it?
Append
ACCEPTANYDATE dateformat 'auto'
in your copy statement.
ACCEPTANYDATE
dateformat
(AWS Documentation)
This'll atleast try to enforce that your copy statements don't fail. Still, some of the unsupported format might be null (as you mentioned,I am fine with the corrupt record(record containing wrong timestamp) not getting loaded to redshift. But other records should be loaded)

Error: Unable to write parameter catalog: SASUSER.PARMS.PARMS.SLIST

I am running a SAS job on Server and getting this error:
Unable to write parameter catalog: SASUSER.PARMS.PARMS.SLIST
Any help/comments will be appreciated
This is symptom of not having write access to the SASUSER library. Usually it is generated by PROC IMPORT which seems incapable of checking the RSASUSER setting and understanding that the SASUSER library is not writable. It should not cause any trouble.

python/pandas: moved a script, get attribute error

I have a working script on one system (python2.7, pandas 16), but when I moved it to a different system with python2.7 and pandas 17, the following line --
df["DATE"] = df["DATE"].map(lambda x: pd.datetools.parse(x))
generates the following error
AttributeError: 'module' object has no attribute 'parse'
I tried to remove pandas17 and load 16 but the whl file -- pandas.0.16.2-cp27-none-win32.whl -- "is not a supported wheel on this platform"
It looks like a versioning issue. Anything else I can try?
Thanks
Use to_datetime:
df["DATE"] = pd.to_datetime(df["DATE"])