How Normalize Data Mining Min Max from Mysql in Python The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceHow Normalize Data Mining Min Max from Database in Python-Flask with LibraryHow do I connect to a MySQL Database in Python?How Normalize Data Mining in Python with libraryHow do I copy a file in Python?How can I safely create a nested directory in Python?How do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get the current time in PythonHow can I make a time delay in Python?How do I get the number of elements in a list in Python?How do I concatenate two lists in Python?How do I lowercase a string in Python?How to remove a key from a Python dictionary?
How to handle characters who are more educated than the author?
Mortgage adviser recommends a longer term than necessary combined with overpayments
Am I ethically obligated to go into work on an off day if the reason is sudden?
What is the padding with red substance inside of steak packaging?
What force causes entropy to increase?
Would an alien lifeform be able to achieve space travel if lacking in vision?
"is" operation returns false even though two objects have same id
Variable with quotation marks "$()"
Working through the single responsibility principle (SRP) in Python when calls are expensive
What's the point in a preamp?
Student Loan from years ago pops up and is taking my salary
Is there a writing software that you can sort scenes like slides in PowerPoint?
Identify 80s or 90s comics with ripped creatures (not dwarves)
One-dimensional Japanese puzzle
how can a perfect fourth interval be considered either consonant or dissonant?
How do spell lists change if the party levels up without taking a long rest?
What was the last x86 CPU that did not have the x87 floating-point unit built in?
Can each chord in a progression create its own key?
Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?
Does Parliament hold absolute power in the UK?
Why did Peik Lin say, "I'm not an animal"?
"... to apply for a visa" or "... and applied for a visa"?
Store Dynamic-accessible hidden metadata in a cell
What happens to a Warlock's expended Spell Slots when they gain a Level?
How Normalize Data Mining Min Max from Mysql in Python
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceHow Normalize Data Mining Min Max from Database in Python-Flask with LibraryHow do I connect to a MySQL Database in Python?How Normalize Data Mining in Python with libraryHow do I copy a file in Python?How can I safely create a nested directory in Python?How do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get the current time in PythonHow can I make a time delay in Python?How do I get the number of elements in a list in Python?How do I concatenate two lists in Python?How do I lowercase a string in Python?How to remove a key from a Python dictionary?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
This is example of my data in mysql, I use lib flashext.mysql and python 3
RT NK NB SU SK P TNI IK IB TARGET
84876 902 1192 2098 3623 169 39 133 1063 94095
79194 902 1050 2109 3606 153 39 133 806 87992
75836 902 1060 1905 3166 161 39 133 785 83987
75571 902 112 1878 3190 158 39 133 635 82618
83797 1156 134 1900 3518 218 39 133 709 91604
91648 1291 127 2225 3596 249 39 133 659 99967
The formula MinMax is
(data-min)/(max-min)*0.8+0.1
I got the code normalize data from csv
import pandas as pd
df = pd.read_csv("dataset.csv")
norm = (df - df.min()) / (df.max() - df.min() )*0.8 + 0.1
I know how to count it like this
(first data of RT - min column RT data) / (max column RT- min column RT) * 0.8 + 0.1
So does the next column
(first data of NK - min column NK data) / (max column NK- min column NK) * 0.8 + 0.1
Please help me, How to normalize data from database, it call "dataset" and normalize it and input in another table call "normalize"
python mysql normalization minmax
|
show 4 more comments
This is example of my data in mysql, I use lib flashext.mysql and python 3
RT NK NB SU SK P TNI IK IB TARGET
84876 902 1192 2098 3623 169 39 133 1063 94095
79194 902 1050 2109 3606 153 39 133 806 87992
75836 902 1060 1905 3166 161 39 133 785 83987
75571 902 112 1878 3190 158 39 133 635 82618
83797 1156 134 1900 3518 218 39 133 709 91604
91648 1291 127 2225 3596 249 39 133 659 99967
The formula MinMax is
(data-min)/(max-min)*0.8+0.1
I got the code normalize data from csv
import pandas as pd
df = pd.read_csv("dataset.csv")
norm = (df - df.min()) / (df.max() - df.min() )*0.8 + 0.1
I know how to count it like this
(first data of RT - min column RT data) / (max column RT- min column RT) * 0.8 + 0.1
So does the next column
(first data of NK - min column NK data) / (max column NK- min column NK) * 0.8 + 0.1
Please help me, How to normalize data from database, it call "dataset" and normalize it and input in another table call "normalize"
python mysql normalization minmax
Are you asking to turn your formulas into python or how to manage the database or how to manage the database via python (or something else)?
– combinatorist
Mar 10 at 5:08
It looks like you have a valid solution in Python with Pandas. Are you trying to translate the same calculation into MySQL (perhaps run via python)?
– combinatorist
Mar 10 at 5:09
before, I asked the same thing in another account. but it was from CSV which was then normalized and I got the formula and it worked (this is a formula) " import pandas as pd df = pd.read_csv("dataset.csv") norm = (df - df.min()) / (df.max() - df.min() )*0.8 + 0.1". and now I want to ask how to normalize data from a database not from CSV
– LearnCoding
Mar 10 at 5:13
yes i mean like that, can you help me?
– LearnCoding
Mar 10 at 5:14
Ok, so do you want to pull the data from MySQL and then normalize it in pandas or do you want to MySQL to do the normalization calculation?
– combinatorist
Mar 10 at 5:15
|
show 4 more comments
This is example of my data in mysql, I use lib flashext.mysql and python 3
RT NK NB SU SK P TNI IK IB TARGET
84876 902 1192 2098 3623 169 39 133 1063 94095
79194 902 1050 2109 3606 153 39 133 806 87992
75836 902 1060 1905 3166 161 39 133 785 83987
75571 902 112 1878 3190 158 39 133 635 82618
83797 1156 134 1900 3518 218 39 133 709 91604
91648 1291 127 2225 3596 249 39 133 659 99967
The formula MinMax is
(data-min)/(max-min)*0.8+0.1
I got the code normalize data from csv
import pandas as pd
df = pd.read_csv("dataset.csv")
norm = (df - df.min()) / (df.max() - df.min() )*0.8 + 0.1
I know how to count it like this
(first data of RT - min column RT data) / (max column RT- min column RT) * 0.8 + 0.1
So does the next column
(first data of NK - min column NK data) / (max column NK- min column NK) * 0.8 + 0.1
Please help me, How to normalize data from database, it call "dataset" and normalize it and input in another table call "normalize"
python mysql normalization minmax
This is example of my data in mysql, I use lib flashext.mysql and python 3
RT NK NB SU SK P TNI IK IB TARGET
84876 902 1192 2098 3623 169 39 133 1063 94095
79194 902 1050 2109 3606 153 39 133 806 87992
75836 902 1060 1905 3166 161 39 133 785 83987
75571 902 112 1878 3190 158 39 133 635 82618
83797 1156 134 1900 3518 218 39 133 709 91604
91648 1291 127 2225 3596 249 39 133 659 99967
The formula MinMax is
(data-min)/(max-min)*0.8+0.1
I got the code normalize data from csv
import pandas as pd
df = pd.read_csv("dataset.csv")
norm = (df - df.min()) / (df.max() - df.min() )*0.8 + 0.1
I know how to count it like this
(first data of RT - min column RT data) / (max column RT- min column RT) * 0.8 + 0.1
So does the next column
(first data of NK - min column NK data) / (max column NK- min column NK) * 0.8 + 0.1
Please help me, How to normalize data from database, it call "dataset" and normalize it and input in another table call "normalize"
python mysql normalization minmax
python mysql normalization minmax
edited Mar 10 at 9:20
Anony-Mousse
59.3k797163
59.3k797163
asked Mar 10 at 4:06
LearnCodingLearnCoding
265
265
Are you asking to turn your formulas into python or how to manage the database or how to manage the database via python (or something else)?
– combinatorist
Mar 10 at 5:08
It looks like you have a valid solution in Python with Pandas. Are you trying to translate the same calculation into MySQL (perhaps run via python)?
– combinatorist
Mar 10 at 5:09
before, I asked the same thing in another account. but it was from CSV which was then normalized and I got the formula and it worked (this is a formula) " import pandas as pd df = pd.read_csv("dataset.csv") norm = (df - df.min()) / (df.max() - df.min() )*0.8 + 0.1". and now I want to ask how to normalize data from a database not from CSV
– LearnCoding
Mar 10 at 5:13
yes i mean like that, can you help me?
– LearnCoding
Mar 10 at 5:14
Ok, so do you want to pull the data from MySQL and then normalize it in pandas or do you want to MySQL to do the normalization calculation?
– combinatorist
Mar 10 at 5:15
|
show 4 more comments
Are you asking to turn your formulas into python or how to manage the database or how to manage the database via python (or something else)?
– combinatorist
Mar 10 at 5:08
It looks like you have a valid solution in Python with Pandas. Are you trying to translate the same calculation into MySQL (perhaps run via python)?
– combinatorist
Mar 10 at 5:09
before, I asked the same thing in another account. but it was from CSV which was then normalized and I got the formula and it worked (this is a formula) " import pandas as pd df = pd.read_csv("dataset.csv") norm = (df - df.min()) / (df.max() - df.min() )*0.8 + 0.1". and now I want to ask how to normalize data from a database not from CSV
– LearnCoding
Mar 10 at 5:13
yes i mean like that, can you help me?
– LearnCoding
Mar 10 at 5:14
Ok, so do you want to pull the data from MySQL and then normalize it in pandas or do you want to MySQL to do the normalization calculation?
– combinatorist
Mar 10 at 5:15
Are you asking to turn your formulas into python or how to manage the database or how to manage the database via python (or something else)?
– combinatorist
Mar 10 at 5:08
Are you asking to turn your formulas into python or how to manage the database or how to manage the database via python (or something else)?
– combinatorist
Mar 10 at 5:08
It looks like you have a valid solution in Python with Pandas. Are you trying to translate the same calculation into MySQL (perhaps run via python)?
– combinatorist
Mar 10 at 5:09
It looks like you have a valid solution in Python with Pandas. Are you trying to translate the same calculation into MySQL (perhaps run via python)?
– combinatorist
Mar 10 at 5:09
before, I asked the same thing in another account. but it was from CSV which was then normalized and I got the formula and it worked (this is a formula) " import pandas as pd df = pd.read_csv("dataset.csv") norm = (df - df.min()) / (df.max() - df.min() )*0.8 + 0.1". and now I want to ask how to normalize data from a database not from CSV
– LearnCoding
Mar 10 at 5:13
before, I asked the same thing in another account. but it was from CSV which was then normalized and I got the formula and it worked (this is a formula) " import pandas as pd df = pd.read_csv("dataset.csv") norm = (df - df.min()) / (df.max() - df.min() )*0.8 + 0.1". and now I want to ask how to normalize data from a database not from CSV
– LearnCoding
Mar 10 at 5:13
yes i mean like that, can you help me?
– LearnCoding
Mar 10 at 5:14
yes i mean like that, can you help me?
– LearnCoding
Mar 10 at 5:14
Ok, so do you want to pull the data from MySQL and then normalize it in pandas or do you want to MySQL to do the normalization calculation?
– combinatorist
Mar 10 at 5:15
Ok, so do you want to pull the data from MySQL and then normalize it in pandas or do you want to MySQL to do the normalization calculation?
– combinatorist
Mar 10 at 5:15
|
show 4 more comments
1 Answer
1
active
oldest
votes
Here is a SQL query that should get you started (assuming you want to calculate it per column):
create table normalize as
select
(RT - min(RT)over()) / (max(RT)over() - min(RT)over()) * 0.8 + 0.1 as RT_norm
from test;
I tested this query in sqlite3, not MySQL. It isn't necessarily optimal, but intuitively follows the formula. Notice, the over
turns the min / max aggregate functions into window functions, which means they look at whole column, but the result is repeated on each row.
Todo
You would still need to:
- send the MySQl query via Python
- repeat the same code for each column
- give each column a name
- assign the resulting table to a schema (most likely)
- handle divide by 0 in case a column max and min are equal
Consider: stackoverflow.com/questions/372885/…
– combinatorist
Mar 10 at 5:34
how if I already made a normalize table?
– LearnCoding
Mar 10 at 5:46
by the way, I have already posted more detailed questions
– LearnCoding
Mar 10 at 6:07
stackoverflow.com/questions/55084936/…
– LearnCoding
Mar 10 at 6:08
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55084336%2fhow-normalize-data-mining-min-max-from-mysql-in-python%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is a SQL query that should get you started (assuming you want to calculate it per column):
create table normalize as
select
(RT - min(RT)over()) / (max(RT)over() - min(RT)over()) * 0.8 + 0.1 as RT_norm
from test;
I tested this query in sqlite3, not MySQL. It isn't necessarily optimal, but intuitively follows the formula. Notice, the over
turns the min / max aggregate functions into window functions, which means they look at whole column, but the result is repeated on each row.
Todo
You would still need to:
- send the MySQl query via Python
- repeat the same code for each column
- give each column a name
- assign the resulting table to a schema (most likely)
- handle divide by 0 in case a column max and min are equal
Consider: stackoverflow.com/questions/372885/…
– combinatorist
Mar 10 at 5:34
how if I already made a normalize table?
– LearnCoding
Mar 10 at 5:46
by the way, I have already posted more detailed questions
– LearnCoding
Mar 10 at 6:07
stackoverflow.com/questions/55084936/…
– LearnCoding
Mar 10 at 6:08
add a comment |
Here is a SQL query that should get you started (assuming you want to calculate it per column):
create table normalize as
select
(RT - min(RT)over()) / (max(RT)over() - min(RT)over()) * 0.8 + 0.1 as RT_norm
from test;
I tested this query in sqlite3, not MySQL. It isn't necessarily optimal, but intuitively follows the formula. Notice, the over
turns the min / max aggregate functions into window functions, which means they look at whole column, but the result is repeated on each row.
Todo
You would still need to:
- send the MySQl query via Python
- repeat the same code for each column
- give each column a name
- assign the resulting table to a schema (most likely)
- handle divide by 0 in case a column max and min are equal
Consider: stackoverflow.com/questions/372885/…
– combinatorist
Mar 10 at 5:34
how if I already made a normalize table?
– LearnCoding
Mar 10 at 5:46
by the way, I have already posted more detailed questions
– LearnCoding
Mar 10 at 6:07
stackoverflow.com/questions/55084936/…
– LearnCoding
Mar 10 at 6:08
add a comment |
Here is a SQL query that should get you started (assuming you want to calculate it per column):
create table normalize as
select
(RT - min(RT)over()) / (max(RT)over() - min(RT)over()) * 0.8 + 0.1 as RT_norm
from test;
I tested this query in sqlite3, not MySQL. It isn't necessarily optimal, but intuitively follows the formula. Notice, the over
turns the min / max aggregate functions into window functions, which means they look at whole column, but the result is repeated on each row.
Todo
You would still need to:
- send the MySQl query via Python
- repeat the same code for each column
- give each column a name
- assign the resulting table to a schema (most likely)
- handle divide by 0 in case a column max and min are equal
Here is a SQL query that should get you started (assuming you want to calculate it per column):
create table normalize as
select
(RT - min(RT)over()) / (max(RT)over() - min(RT)over()) * 0.8 + 0.1 as RT_norm
from test;
I tested this query in sqlite3, not MySQL. It isn't necessarily optimal, but intuitively follows the formula. Notice, the over
turns the min / max aggregate functions into window functions, which means they look at whole column, but the result is repeated on each row.
Todo
You would still need to:
- send the MySQl query via Python
- repeat the same code for each column
- give each column a name
- assign the resulting table to a schema (most likely)
- handle divide by 0 in case a column max and min are equal
answered Mar 10 at 5:32
combinatoristcombinatorist
415214
415214
Consider: stackoverflow.com/questions/372885/…
– combinatorist
Mar 10 at 5:34
how if I already made a normalize table?
– LearnCoding
Mar 10 at 5:46
by the way, I have already posted more detailed questions
– LearnCoding
Mar 10 at 6:07
stackoverflow.com/questions/55084936/…
– LearnCoding
Mar 10 at 6:08
add a comment |
Consider: stackoverflow.com/questions/372885/…
– combinatorist
Mar 10 at 5:34
how if I already made a normalize table?
– LearnCoding
Mar 10 at 5:46
by the way, I have already posted more detailed questions
– LearnCoding
Mar 10 at 6:07
stackoverflow.com/questions/55084936/…
– LearnCoding
Mar 10 at 6:08
Consider: stackoverflow.com/questions/372885/…
– combinatorist
Mar 10 at 5:34
Consider: stackoverflow.com/questions/372885/…
– combinatorist
Mar 10 at 5:34
how if I already made a normalize table?
– LearnCoding
Mar 10 at 5:46
how if I already made a normalize table?
– LearnCoding
Mar 10 at 5:46
by the way, I have already posted more detailed questions
– LearnCoding
Mar 10 at 6:07
by the way, I have already posted more detailed questions
– LearnCoding
Mar 10 at 6:07
stackoverflow.com/questions/55084936/…
– LearnCoding
Mar 10 at 6:08
stackoverflow.com/questions/55084936/…
– LearnCoding
Mar 10 at 6:08
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55084336%2fhow-normalize-data-mining-min-max-from-mysql-in-python%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you asking to turn your formulas into python or how to manage the database or how to manage the database via python (or something else)?
– combinatorist
Mar 10 at 5:08
It looks like you have a valid solution in Python with Pandas. Are you trying to translate the same calculation into MySQL (perhaps run via python)?
– combinatorist
Mar 10 at 5:09
before, I asked the same thing in another account. but it was from CSV which was then normalized and I got the formula and it worked (this is a formula) " import pandas as pd df = pd.read_csv("dataset.csv") norm = (df - df.min()) / (df.max() - df.min() )*0.8 + 0.1". and now I want to ask how to normalize data from a database not from CSV
– LearnCoding
Mar 10 at 5:13
yes i mean like that, can you help me?
– LearnCoding
Mar 10 at 5:14
Ok, so do you want to pull the data from MySQL and then normalize it in pandas or do you want to MySQL to do the normalization calculation?
– combinatorist
Mar 10 at 5:15