I cant insert a negative number in sql database beacuse it is a negative, I already change the type of data from int to decimal and still not working.
The firts negative number in dataframe is the error, the '-5'
Pos Team Pld W D L GF GA GD Pts
0 1 Flamengo (C) 38 21 8 9 68 48 +20 71
1 2 Internacional 38 20 10 8 61 35 +26 70
2 3 Atlético Mineiro 38 20 8 10 64 45 +19 68
3 4 São Paulo 38 18 12 8 59 41 +18 66
4 5 Fluminense 38 18 10 10 55 42 +13 64
5 6 Grêmio 38 14 17 7 53 40 +13 59
6 7 Palmeiras 38 15 13 10 51 37 +14 58
7 8 Santos 38 14 12 12 52 51 +1 54
8 9 Athletico Paranaense 38 15 8 15 38 36 +2 53
9 10 Red Bull Bragantino 38 13 14 11 50 40 +10 53
10 11 Ceará 38 14 10 14 54 51 +3 52
11 12 Corinthians 38 13 12 13 45 45 0 51
12 13 Atlético Goianiense 38 12 14 12 40 45 −5 50
13 14 Bahia 38 12 8 18 48 59 −11 44
14 15 Sport 38 12 6 20 31 50 −19 42
15 16 Fortaleza 38 10 11 17 34 44 −10 41
16 17 Vasco da Gama (R) 38 10 11 17 37 56 −19 41
17 18 Goiás (R) 38 9 10 19 41 63 −22 37
18 19 Coritiba (R) 38 7 10 21 31 54 −23 31
19 20 Botafogo (R) 38 5 12 21 32 62 −30 27
queryCreateTable = """CREATE TABLE FOOTBALL(
Pos int(2) not null,
Team varchar(255) not null,
J int(2) not null,
V int(2) not null,
E int(2) not null,
D int(2) not null,
GP int(2) not null,
GC int(2) not null,
SG decimal(3) not null,
Pts int(2) not null)"""
cursor.execute(queryCreateTable)
mySql_insert_query = """INSERT INTO football (Pos, Team, J, V, E, D, GP, GC, SG, Pts)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) """
cursor.executemany(mySql_insert_query, tuples_list)
connection.commit()
and the ouput is 1366 (HY000): Incorrect decimal value: '−5' for column 'GD' at row 13