Kaggle Exercise: Missing Values - artificial-intelligence

I am trying to submit my solution to Exercise: Missing Values but getting the following error after submission
ERROR: Unable to find 1459 required key values in the 'Id' column
ERROR: Unable to find the required key value '1461' in the 'Id' column
.
.
.
ERROR: Unable to find the required key value '1469' in the 'Id' column
The thing is that the test dataset only has 1459 rows, from the error it seems like validation set expecting more entries?

If you go to output/submission.csv, you'll notice that the Id starts at 0. Then look at input/sample_submission.csv and notice that it's Id starts at 1461, which is what the competition is expecting. The original test data starts at 1461. What likely happened is that you lost the original Id numbers in the test DataFrame used to write the output.
You can fix it like this:
output = pd.DataFrame({'Id': X_test.index,
'SalePrice': preds_test})
X_Test contains your original Id numbers and will ensure your output is correct.

When you read the csv file at the beginning look that you put the index_col='Id' parameter.
df_train_full = pd.read_csv("/kaggle/input/.../train.csv", index_col='Id')
df_test_full = pd.read_csv("/kaggle/input/.../test.csv", index_col='Id')

Related

create varchar sequence in ADF throw ORA-01722

Friends i am working on jdev12c but i am facing issue i am able to create new record using bc4j tester but when i am trying to change(update) existing data it throws exception Invalid NumberError while selecting entity for CustmerInfo: ORA-01722: invalid number
I have searched for this error but i am not able to get solution just to provide more information I have one master and 2 child tables.In master table i have 2 column which uses DBSequence(seq and trigger from database) and one mandatory date field(timestamp).
I have found out the reason actually the customernumber column is varchar because i am concatenating the sequence with prefix and then storing it.now the problem is as soon as i change entity attribute to DBSEQUENCE it throws invalid number error for updation
DBSequence should only be used if the value you are getting is populated form a DB Sequence - which would be a number.
If you are manually populating that field - then use a regular String type for the field.

Salesforce - converting leads in opportunities, error message

I have problems converting my leads in Opportunities on Salesforce. Whenever I convert a saved lead, I get the following error message below the field: "Converted Status: Qualified".
Error: System.DmlException: Insert failed. First exception on row 0;
first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, bad value for
restricted picklist field: 1. first contact: [Partnership_Level__c]
Class.leadconvert.BulkLeadConvert.handleRegularAccountInserts: line
226, column 1 Class.leadconvert.BulkLeadConvert.convertLead: line 88,
column 1
Can anyone help?
Best,
Nicholas
You need to check values of Picklist fields which your code populate, seems you are just trying to assign value to field, which is not included in list of available values. Try to use debug logs for getting more info.
Also, on picklist fields exists such option as 'Restrict picklist to the values defined in the value set', you can try to uncheck it for avoiding mentioned issue.

Error: Unknown duplicates value on record with id

I'm trying to Upsert the data to Account object using an external tool, Everything works fine but Salesforce is throwing error for few records when upserting.
I was doing the upsertion process using the external id field. Except external id field no other field is having a unique constraint.
I'm getting the following error -
SF_ERROR: DUPLICATE_VALUE
OBJ: Account - duplicate value found: unknown duplicates value on record with id: 001***********
Please help me to solve the issue.
This is happening because your trying to create Salesforce contact multiple times with same email and data
It's silly but this was happening to me because SFDC considers 'NULL' as a unique value... Mostly because Excel converted 'NULL' to text and was trying to bring in the literal word 'NULL'.

"Data conversion error" with BULK INSERT

I am trying to import some data into SQL Server using the Bulk insert command--
This is the error I am getting--
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 6 (NClaims).
Now, I created a test file with only one row of data which I was able to import successfully--
00000005^^18360810^408^30^0
However when I added 2 more rows of data (which are very similar to the row above) I got the error message that I have given above. These are the 2 additional rows of data--
00000003^^18360801^142^42^0
00000004^^18360000^142^10^0
As you can see there does not seem to be any difference (in terms of data length or data types for the 2 rows above compared with the single row given previously)... So why am I getting this error? How do I fix it?
EDIT--
This is the command I am executing--
BULK INSERT GooglePatentsIndividualDec2012.dbo.patent
FROM 'C:\Arvind Google Patents Data\patents\1patents_test.csv'
WITH ( FIELDTERMINATOR = '^', ROWTERMINATOR='\n');
Be patient and make experiments excluding one thing at a time. For example:
Remove third row and check if everything ok.
If yes, return this row but change 10^0 to 42^0, check again.
Repeat step 2 with all data changing it to values in row 2 which is ok.
You will find the piece of data which causes error.

Inserting an array column into the db in Yii

I needed to insert an array field into a database and I was pleased to notice that PostGreSQL had that functionality. But now I am not able to insert the data using the tables active record.
I have tried the below calls with no success
$active_record->array_column = $_array_of_values;
which gives me the exception
Exception Raised:CDbCommand failed to execute the SQL statement: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: array value must start with "{" or dimension information
I have also tried this using
foreach($_array_of_values as $value){
$active_record->array_column[] = $value;
}
which tells me
Indirect modification of overloaded property FeatureRaw::$colors_names has no effect
Can anyone help me with this?
Thanks!
Data must be inserted in the form (text representation of an ARRAY):
INSERT INTO tbl (arr_col) VALUES ('{23,45}')
Or:
INSERT INTO tbl (arr_col) VALUES ('{foo,"bar, with comma"}')
So you need to enclose your array values in '{}' and separate them with comma ,. Use double quotes "" around text values that include a comma.
I listed more syntax variants to insert arrays in a related answer.
For those who also have same problem:
I didn't check the Yii1 behavior, but in Yii2 you simply can insert array as properly formed string as Erwin Brandstetter mentioned in his comment:
$activeRecord->arrayField = '{' . implode(',',$array_values) . '}';
Of course you need to make additional efforts when your $array_values has strings with commas, etc. And you still need to convert value back to array after you load ActiveRecord.
You can make these conversions in ActiveRecord's beforeSave() and afterLoad() and you will not need to convert values manually.
UPD. Recently I made a simple behavior for Yii2 to use array fields with ActiveRecord without manual field building: kossmoss/yii2-postgresql-array-field. It is more generalized way to solve the problem and I hope it will help. For those who use Yii1: you can investigate the package code and create your own solutuion compatible with your framework.

Resources