Skip to content
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

List Comprehension Error? #7

Open
gregcman opened this issue Jun 29, 2021 · 1 comment
Open

List Comprehension Error? #7

gregcman opened this issue Jun 29, 2021 · 1 comment

Comments

@gregcman
Copy link

Untitled

y_train[y_train[:] == 1]
and
y_train[y_train[:] == 0]

both return 537 rows.

@ischoeff
Copy link

Yes can confirm that with docker jupyter/scipy-notebook:notebook-6.4.12.
It uses Python 3.10.6, pandas 1.5.0.
It works with:

print("Original True : {0} ({1:0.2f}%)".format(len(df.loc[df['diabetes'] == 1]), (len(df.loc[df['diabetes'] == 1])/len(df.index)) * 100.0))
print("Original False : {0} ({1:0.2f}%)".format(len(df.loc[df['diabetes'] == 0]), (len(df.loc[df['diabetes'] == 0])/len(df.index)) * 100.0))
print("")
print("Training True : {0} ({1:0.2f}%)".format(y_train.value_counts()[1], y_train.value_counts()[1] / y_train.size * 100))
print("Training False : {0} ({1:0.2f}%)".format(y_train.value_counts()[0], y_train.value_counts()[0] / y_train.size * 100))
print("")
print("Test True : {0} ({1:0.2f}%)".format(y_test.value_counts()[1], y_test.value_counts()[1] / y_test.size * 100))
print("Test False : {0} ({1:0.2f}%)".format(y_test.value_counts()[0], y_test.value_counts()[0] / y_test.size * 100))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants