Scatter plot is not sort in matplotlib from csv file
My Code:
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv("linear_regression_dataset.csv", sep=";")
plt.scatter(df.Deneyim,df.Maas)
plt.xlabel("deneyim")
plt.ylabel("maas")
plt.show()
result image :
Is there a solution proposal?
That's the graphic I want to be image:
python-3.x matplotlib
add a comment |
My Code:
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv("linear_regression_dataset.csv", sep=";")
plt.scatter(df.Deneyim,df.Maas)
plt.xlabel("deneyim")
plt.ylabel("maas")
plt.show()
result image :
Is there a solution proposal?
That's the graphic I want to be image:
python-3.x matplotlib
1
Hi there, welcome to Stack Overflow! It isn't clear what your problem is, or what you are looking for a solution to. Please read about how to ask good questions, as well as this question checklist and update your question accordingly. Thanks!
– TrebuchetMS
Nov 14 '18 at 9:08
1
Your values are stored as object in thedf
instead of numbers. Make sure they are numbers. Because we don't have access to the data it's not clear why you have objects, so one cannot help further.
– ImportanceOfBeingErnest
Nov 14 '18 at 9:25
Please clarify your question. It's absolutely not clear what your problem is, what you expect your result to be and how your current result deviates from that. See stackoverflow.com/help/how-to-ask and codeblog.jonskeet.uk/2012/11/24/…
– planetmaker
Nov 14 '18 at 12:02
I added the result I wanted to see
– Burak MAKAV
Nov 14 '18 at 13:00
add a comment |
My Code:
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv("linear_regression_dataset.csv", sep=";")
plt.scatter(df.Deneyim,df.Maas)
plt.xlabel("deneyim")
plt.ylabel("maas")
plt.show()
result image :
Is there a solution proposal?
That's the graphic I want to be image:
python-3.x matplotlib
My Code:
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv("linear_regression_dataset.csv", sep=";")
plt.scatter(df.Deneyim,df.Maas)
plt.xlabel("deneyim")
plt.ylabel("maas")
plt.show()
result image :
Is there a solution proposal?
That's the graphic I want to be image:
python-3.x matplotlib
python-3.x matplotlib
edited Nov 14 '18 at 12:58
Burak MAKAV
asked Nov 14 '18 at 8:56
Burak MAKAVBurak MAKAV
11
11
1
Hi there, welcome to Stack Overflow! It isn't clear what your problem is, or what you are looking for a solution to. Please read about how to ask good questions, as well as this question checklist and update your question accordingly. Thanks!
– TrebuchetMS
Nov 14 '18 at 9:08
1
Your values are stored as object in thedf
instead of numbers. Make sure they are numbers. Because we don't have access to the data it's not clear why you have objects, so one cannot help further.
– ImportanceOfBeingErnest
Nov 14 '18 at 9:25
Please clarify your question. It's absolutely not clear what your problem is, what you expect your result to be and how your current result deviates from that. See stackoverflow.com/help/how-to-ask and codeblog.jonskeet.uk/2012/11/24/…
– planetmaker
Nov 14 '18 at 12:02
I added the result I wanted to see
– Burak MAKAV
Nov 14 '18 at 13:00
add a comment |
1
Hi there, welcome to Stack Overflow! It isn't clear what your problem is, or what you are looking for a solution to. Please read about how to ask good questions, as well as this question checklist and update your question accordingly. Thanks!
– TrebuchetMS
Nov 14 '18 at 9:08
1
Your values are stored as object in thedf
instead of numbers. Make sure they are numbers. Because we don't have access to the data it's not clear why you have objects, so one cannot help further.
– ImportanceOfBeingErnest
Nov 14 '18 at 9:25
Please clarify your question. It's absolutely not clear what your problem is, what you expect your result to be and how your current result deviates from that. See stackoverflow.com/help/how-to-ask and codeblog.jonskeet.uk/2012/11/24/…
– planetmaker
Nov 14 '18 at 12:02
I added the result I wanted to see
– Burak MAKAV
Nov 14 '18 at 13:00
1
1
Hi there, welcome to Stack Overflow! It isn't clear what your problem is, or what you are looking for a solution to. Please read about how to ask good questions, as well as this question checklist and update your question accordingly. Thanks!
– TrebuchetMS
Nov 14 '18 at 9:08
Hi there, welcome to Stack Overflow! It isn't clear what your problem is, or what you are looking for a solution to. Please read about how to ask good questions, as well as this question checklist and update your question accordingly. Thanks!
– TrebuchetMS
Nov 14 '18 at 9:08
1
1
Your values are stored as object in the
df
instead of numbers. Make sure they are numbers. Because we don't have access to the data it's not clear why you have objects, so one cannot help further.– ImportanceOfBeingErnest
Nov 14 '18 at 9:25
Your values are stored as object in the
df
instead of numbers. Make sure they are numbers. Because we don't have access to the data it's not clear why you have objects, so one cannot help further.– ImportanceOfBeingErnest
Nov 14 '18 at 9:25
Please clarify your question. It's absolutely not clear what your problem is, what you expect your result to be and how your current result deviates from that. See stackoverflow.com/help/how-to-ask and codeblog.jonskeet.uk/2012/11/24/…
– planetmaker
Nov 14 '18 at 12:02
Please clarify your question. It's absolutely not clear what your problem is, what you expect your result to be and how your current result deviates from that. See stackoverflow.com/help/how-to-ask and codeblog.jonskeet.uk/2012/11/24/…
– planetmaker
Nov 14 '18 at 12:02
I added the result I wanted to see
– Burak MAKAV
Nov 14 '18 at 13:00
I added the result I wanted to see
– Burak MAKAV
Nov 14 '18 at 13:00
add a comment |
1 Answer
1
active
oldest
votes
sort the dataframe first and then you can plot
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv("linear_regression_dataset.csv", sep=";")
df['Mass']= df['Mass'].astype(int)
df.sort_values('Maas',inplace=True)
plt.scatter(df.Deneyim,df.Maas)
plt.xlabel("deneyim")
plt.ylabel("maas")
plt.show()
Why do you mean by doesnt work. Did you got any error?
– AI_Learning
Nov 14 '18 at 13:12
Its done thanks
– Burak MAKAV
Nov 14 '18 at 13:16
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%2f53296275%2fscatter-plot-is-not-sort-in-matplotlib-from-csv-file%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
sort the dataframe first and then you can plot
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv("linear_regression_dataset.csv", sep=";")
df['Mass']= df['Mass'].astype(int)
df.sort_values('Maas',inplace=True)
plt.scatter(df.Deneyim,df.Maas)
plt.xlabel("deneyim")
plt.ylabel("maas")
plt.show()
Why do you mean by doesnt work. Did you got any error?
– AI_Learning
Nov 14 '18 at 13:12
Its done thanks
– Burak MAKAV
Nov 14 '18 at 13:16
add a comment |
sort the dataframe first and then you can plot
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv("linear_regression_dataset.csv", sep=";")
df['Mass']= df['Mass'].astype(int)
df.sort_values('Maas',inplace=True)
plt.scatter(df.Deneyim,df.Maas)
plt.xlabel("deneyim")
plt.ylabel("maas")
plt.show()
Why do you mean by doesnt work. Did you got any error?
– AI_Learning
Nov 14 '18 at 13:12
Its done thanks
– Burak MAKAV
Nov 14 '18 at 13:16
add a comment |
sort the dataframe first and then you can plot
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv("linear_regression_dataset.csv", sep=";")
df['Mass']= df['Mass'].astype(int)
df.sort_values('Maas',inplace=True)
plt.scatter(df.Deneyim,df.Maas)
plt.xlabel("deneyim")
plt.ylabel("maas")
plt.show()
sort the dataframe first and then you can plot
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv("linear_regression_dataset.csv", sep=";")
df['Mass']= df['Mass'].astype(int)
df.sort_values('Maas',inplace=True)
plt.scatter(df.Deneyim,df.Maas)
plt.xlabel("deneyim")
plt.ylabel("maas")
plt.show()
edited Nov 14 '18 at 13:14
answered Nov 14 '18 at 13:04
AI_LearningAI_Learning
2,8382730
2,8382730
Why do you mean by doesnt work. Did you got any error?
– AI_Learning
Nov 14 '18 at 13:12
Its done thanks
– Burak MAKAV
Nov 14 '18 at 13:16
add a comment |
Why do you mean by doesnt work. Did you got any error?
– AI_Learning
Nov 14 '18 at 13:12
Its done thanks
– Burak MAKAV
Nov 14 '18 at 13:16
Why do you mean by doesnt work. Did you got any error?
– AI_Learning
Nov 14 '18 at 13:12
Why do you mean by doesnt work. Did you got any error?
– AI_Learning
Nov 14 '18 at 13:12
Its done thanks
– Burak MAKAV
Nov 14 '18 at 13:16
Its done thanks
– Burak MAKAV
Nov 14 '18 at 13:16
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%2f53296275%2fscatter-plot-is-not-sort-in-matplotlib-from-csv-file%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
1
Hi there, welcome to Stack Overflow! It isn't clear what your problem is, or what you are looking for a solution to. Please read about how to ask good questions, as well as this question checklist and update your question accordingly. Thanks!
– TrebuchetMS
Nov 14 '18 at 9:08
1
Your values are stored as object in the
df
instead of numbers. Make sure they are numbers. Because we don't have access to the data it's not clear why you have objects, so one cannot help further.– ImportanceOfBeingErnest
Nov 14 '18 at 9:25
Please clarify your question. It's absolutely not clear what your problem is, what you expect your result to be and how your current result deviates from that. See stackoverflow.com/help/how-to-ask and codeblog.jonskeet.uk/2012/11/24/…
– planetmaker
Nov 14 '18 at 12:02
I added the result I wanted to see
– Burak MAKAV
Nov 14 '18 at 13:00