invalid input syntax for type integer - pgadmin-4

enter image description here
ERROR: invalid input syntax for type integer: "1;CA-2016-152156;08/11/2016;11/11/2016;Second Class;CG-12520;Claire Gute;Consumer;United States;Henderson;Kentucky;42420;South;FUR-BO-10001798;Furniture;Bookcases;Bush Somerset Collection Bookcase;261"
CONTEXT: COPY orders, line 2, column row_id: "1;CA-2016-152156;08/11/2016;11/11/2016;Second Class;CG-12520;Claire Gute;Consumer;United States;Hend..."
tolong bantu saya mengatasinya

Related

Error when checking target: expected dense_9 to have 3 dimensions, but got array with shape (2110, 1)

I want to predict stock price and I've defined my model:
model = keras.models.Sequential([
keras.layers.Dense(10, activation='relu',
input_shape=(window, train.shape[1],)),
keras.layers.Dense(5, activation='relu'),
keras.layers.Dense(1)])
model.compile(loss='mse',
optimizer=keras.optimizers.Adam(learning_rate=0.0001, beta_1=0.9,
beta_2=0.999, amsgrad=False))
history = model.fit(train_dataset, train_labels, epochs=150)
I get this error:
Error when checking target: expected dense_9 to have 3 dimensions, but got array with shape (2110, 1)
note: my input is (2110, 22, 16) but my output is (2110,1). 2110 is number of examples.
I need help to fix this.

invalid sign in external "numeric" value error from Npgsql Binary copy

I get this error on using Npgsql Binary copy (see my implementation at the bottom):
invalid sign in external "numeric" value
The RetailCost column on which it fails has the following PostgreSQL properties:
type: numeric(19,2)
nullable: not null
storage: main
default: 0.00
The PostgreSQL log looks like this:
2019-07-15 13:24:05.131 ACST [17856] ERROR: invalid sign in external "numeric" value
2019-07-15 13:24:05.131 ACST [17856] CONTEXT: COPY products_temp, line 1, column RetailCost
2019-07-15 13:24:05.131 ACST [17856] STATEMENT: copy products_temp (...) from stdin (format binary)
I don't think it should matter, but there are only zero or positive RetailCost values (no negative or null ones)
My implementation looks like this:
using (var importer = conn.BeginBinaryImport($"copy {tempTableName} ({dataColumns}) from stdin (format binary)"))
{
foreach (var product in products)
{
importer.StartRow();
importer.Write(product.ManufacturerNumber, NpgsqlDbType.Text);
if (product.LastCostDateTime == null)
importer.WriteNull();
else
importer.Write((DateTime)product.LastCostDateTime, NpgsqlDbType.Timestamp);
importer.Write(product.LastCost, NpgsqlDbType.Numeric);
importer.Write(product.AverageCost, NpgsqlDbType.Numeric);
importer.Write(product.RetailCost, NpgsqlDbType.Numeric);
if (product.TaxPercent == null)
importer.WriteNull();
else
importer.Write((decimal)product.TaxPercent, NpgsqlDbType.Numeric);
importer.Write(product.Active, NpgsqlDbType.Boolean);
importer.Write(product.NumberInStock, NpgsqlDbType.Bigint);
}
importer.Complete();
}
Any suggestions would be welcome
I caused this problem when using MapBigInt, not realizing the column was accidentally numeric(18). Changing the column to bigint fixed my problem.
The cause of the problem was that the importer.Write statements was not in the same order as the dataColumns

Importing CSV file in Neo4j

While using this command
LOAD CSV FROM "file:///artists.csv" AS line
CREATE (:Artist { name: line.Name, year: toInt(line.Year)})
I am getting
Error: Type mismatch: expected Any, Map, Node or Relationship but was List<String> (line 2, column 25 (offset: 68))
"CREATE (:Artist { name: line.Name, year: toInt(line.Year)})"
CSV file
"1","ABBA","1992"
"2","Roxette","1986"
"3","Europe","1979"
"4","The Cardigans","1992"
Your CSV has no header, so you can't access a column by its name, ie when you do this : line.Name.
You have to do it by the column index : line[0]
Cheers
Please try
LOAD CSV WITH HEADERS FROM "file:///artists.csv" AS line
CREATE (:Artist { name: line.Name, year: toInt(line.Year)})
Make sure you have Name and Year columns in the atists.csv file

Extracting a user input from a text file

I have a text file that is called paintingJobs.txt, each line is structured in this way:
Estimate Number, Estimate Date, Customer ID, Final Total, Status (E for Estimate, A for Accepted job or N for Not accepted), and Amount Paid.
Here is an extract:
E5341, 21/09/2015, C102, 440, E, 0
E5342, 21/09/2015, C103, 290, A, 290
E5343, 21/09/2015, C104, 730, N, 0
I would like the user to input any Estimate number and for that line to be outputted. How can I achieve this?
Here is what I came up with but it doesn't work as required:
def option_A():
es_num = str.upper (input ("Please enter the estimate number: "))
with open('paintingJobs.txt', 'r') as file:
line = file.readline ()
print (line, end = '')
if es_num in file:
#print whole line
else:
print("Not found")
I would like to display the information in this format
Estimate Number: the estimate number
Customer ID: the customer ID
Estimate Amount: the final total
Estimate Date: the estimate date
Status: the status
To print the line, I suggest you to simply iterate on each line of the file as follows:
def option_A():
es_num = str.upper (input ("Please enter the estimate number: "))
result = "Not found"
with open('paintingJobs.txt', 'r') as file:
for line in file:
if es_num in line:
result = line
break
print(result)
To format the display, you can split the line with comma as separator to get a list of information. Then format your display, as follows:
data = result.split(',')
print("Estimated number:{0}".format(data[0]))
print("Customer ID:{0}".format(data[2]))
...etc...
Then if you need some data which are more complex to retrieve from the text file, the powerful way is to use regex with for instance the method re.match(...).

XML Parsing error: XML parsing: line 1, character 169, equal expected

Hi i am getting XML Parsing error in the following string.
How to find the error .
<ControllerSetupData>
<MasterSetupData ControllerId="0" ControllerModelId="1" ControllerTypeId="2"
EcolabAccountNumber="040242802" TabId="0" TopicName="test 78" Factors Multiplier="10"
ControllerNumber="78" OZSecondMultiplier="10" InjectionQuantityMultiplier="10"
InstallDate="05/02/2016" Active="false"/>
<DynamicSetupData>
<Data ControllerId="0" ControllerModelId="1" FieldGroupId="6" FieldId="21"
Value="10.225.134.21.1.1" FieldTagValue="" EcolabAccountNumber="040242802"/>
<Data ControllerId="0" ControllerModelId="1" FieldGroupId="6" FieldId="79" Value="78"
FieldTagValue="" EcolabAccountNumber="040242802"/>
</DynamicSetupData>
</ControllerSetupData>
In your XML at
<ControllerSetupData>
<MasterSetupData ControllerId="0" ControllerModelId="1" ControllerTypeId="2"
EcolabAccountNumber="040242802" TabId="0" TopicName="test 78" Factors Multiplier="10"
^^^^^^^
The attribute name Factors must be followed by = and a value

Resources