-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Linear Regression using Pandas #16540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you simplify the problem, and narrow down what the exact bug is? |
The bug is at this line: Please observe the x-axis line, the data is 90, 85, 80, the sequence is reversed. It suppose to be linear in sequence. |
Could you simplify the example output then? You should be able to construct a simple dataframe or series that shows the unexpected output. No need for any of the regression stuff. I'd like the example to be as simple as possible, so we can clarify what the point of confusion is. I think pandas may be behaving as intended here, but I'd like to make sure first. |
I can't simplify the output as you wish, you need to click the link and study the example. |
@lumylovepandas here's a minimal example that demonstrates the problem import pandas as pd
df = pd.DataFrame({"x": [90, 80, 85], "y": [10, 20, 30]})
ax = df.plot(x='x', y='y') Since this doesn't have any extraneous information (like data generation, regression, additional plots) it's easier to see that it's a duplicate of #10118. Could you post there if you have feedback? It'd be valuable to have additional voices there. I can see why the current output is surprising, and it's probably just an implementation detail that's exposed to the user. |
Code Sample from Stamford
Problem description
Pandas doesn't plot the expected graph as the website mention in it.
the bug is at this line:
data.plot(kind='scatter', color='Blue', x='length', y='weight', ax=axes[0],title='Original Values')
lm_original_plot.plot(kind='line', color='Red', x='length', y='weight', ax=axes[0])
The x-axis data is being flipped when pandas try to plot it.
Expected Output
Output of
pd.show_versions()
pandas: 0.20.1
pytest: 3.0.5
pip: 9.0.1
setuptools: 35.0.2
Cython: 0.25.2
numpy: 1.12.1
scipy: 0.19.0
xarray: None
IPython: 6.0.0
sphinx: 1.6.2
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: 3.2.2
numexpr: 2.6.2
feather: None
matplotlib: 2.0.2
openpyxl: 2.4.1
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: 0.9.6
lxml: 3.7.2
bs4: 4.5.3
html5lib: 0.999999999
sqlalchemy: 1.1.5
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: