PYLAB Telegram 275
How to count the occurrence of certain item in an ndarray in Python?

فرض کنید در یک وکتور نامپای منحصر به فردها و تعداشان را میخواهید بدانید...
مناسب برای گرفتم آمار لیبل های دیتاست .

a = numpy.array([0, 3, 0, 1, 0, 1, 2, 1, 0, 0, 0, 0, 1, 3, 4])
unique, counts = numpy.unique(a, return_counts=True)
dict(zip(unique, counts))


{0: 7, 1: 4, 2: 1, 3: 2, 4: 1}



tgoop.com/PyLab/275
Create:
Last Update:

How to count the occurrence of certain item in an ndarray in Python?

فرض کنید در یک وکتور نامپای منحصر به فردها و تعداشان را میخواهید بدانید...
مناسب برای گرفتم آمار لیبل های دیتاست .

a = numpy.array([0, 3, 0, 1, 0, 1, 2, 1, 0, 0, 0, 0, 1, 3, 4])
unique, counts = numpy.unique(a, return_counts=True)
dict(zip(unique, counts))


{0: 7, 1: 4, 2: 1, 3: 2, 4: 1}

BY Python_Labs🐍


Share with your friend now:
tgoop.com/PyLab/275

View MORE
Open in Telegram


Telegram News

Date: |

To edit your name or bio, click the Menu icon and select “Manage Channel.” Private channels are only accessible to subscribers and don’t appear in public searches. To join a private channel, you need to receive a link from the owner (administrator). A private channel is an excellent solution for companies and teams. You can also use this type of channel to write down personal notes, reflections, etc. By the way, you can make your private channel public at any moment. Concise A new window will come up. Enter your channel name and bio. (See the character limits above.) Click “Create.” For crypto enthusiasts, there was the “gm” app, a self-described “meme app” which only allowed users to greet each other with “gm,” or “good morning,” a common acronym thrown around on Crypto Twitter and Discord. But the gm app was shut down back in September after a hacker reportedly gained access to user data.
from us


Telegram Python_Labs🐍
FROM American