How do you get number frequencies in a list, then index into another list?

rlo5029

Python 2.7.5 (Don't judge me)

What I have (e.g.):

numbers = [1,3,5,1,3,5,7,0,2,2,9,1]

frequencies = [0,0,0,0,0,0,0,0,0,0]

I need a for loop that counts by going through the elements of numbers and modifying frequencies accordingly by indexing. frequencies should look like:

[1,3,2,2,0,2,0,1,0,1]

I tried using the len() function...for some reason...I just haven't found a way to incorporate count properly.

gefei
for n in numbers:
    frequencies[n] += 1

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how do you remove a list from another list?

From Dev

How do you remove every instance of a list from another list?

From Dev

How do you add a list to another list in onsen-ui?

From Java

How do you get duplicates in a list in elixir?

From Java

How do I get the number of elements in a list?

From Dev

How do you get the index number of an array rather than the element?

From Dev

Get index of first list and use it in another list

From Dev

Get index of first list and use it in another list

From Dev

How do you initialize and index a list of dictionaries in Python?

From Dev

How do you find the number of occurrence within a list of dictionaries

From Dev

How do you multiply a number in a list thats ['40', '12', '55']?

From Dev

how do you replace only a certain number of items in a list randomly?

From Java

In XQuery, how do you get a list of functions in an imported module?

From Dev

How do you get Json List items with vbnet

From Dev

How do you programmatically get a list of all common parameters?

From Dev

How do you get elements from list of tuples in SML?

From Dev

How do you get the result of a Linq statement as List?

From Dev

How do you get a list of all starting services?

From Dev

Vim: How do you get the change list in script?

From Dev

How do you get Json List items with vbnet

From Dev

How do you get the result of a Linq statement as List?

From Dev

How do I get the list of all terms in a Whoosh index?

From Dev

How do I get a list item by index in elm?

From Dev

How do i get the value of first index in a returned List of array

From Dev

How to get List index of tapped List item?

From Dev

How do I pipe a single number to get a list?

From Dev

How do I get a number of items in a filtered list?

From Dev

How do i get position instead of swapping in list number in python

From Java

how to get just the value of a list in another list?

Related Related

  1. 1

    how do you remove a list from another list?

  2. 2

    How do you remove every instance of a list from another list?

  3. 3

    How do you add a list to another list in onsen-ui?

  4. 4

    How do you get duplicates in a list in elixir?

  5. 5

    How do I get the number of elements in a list?

  6. 6

    How do you get the index number of an array rather than the element?

  7. 7

    Get index of first list and use it in another list

  8. 8

    Get index of first list and use it in another list

  9. 9

    How do you initialize and index a list of dictionaries in Python?

  10. 10

    How do you find the number of occurrence within a list of dictionaries

  11. 11

    How do you multiply a number in a list thats ['40', '12', '55']?

  12. 12

    how do you replace only a certain number of items in a list randomly?

  13. 13

    In XQuery, how do you get a list of functions in an imported module?

  14. 14

    How do you get Json List items with vbnet

  15. 15

    How do you programmatically get a list of all common parameters?

  16. 16

    How do you get elements from list of tuples in SML?

  17. 17

    How do you get the result of a Linq statement as List?

  18. 18

    How do you get a list of all starting services?

  19. 19

    Vim: How do you get the change list in script?

  20. 20

    How do you get Json List items with vbnet

  21. 21

    How do you get the result of a Linq statement as List?

  22. 22

    How do I get the list of all terms in a Whoosh index?

  23. 23

    How do I get a list item by index in elm?

  24. 24

    How do i get the value of first index in a returned List of array

  25. 25

    How to get List index of tapped List item?

  26. 26

    How do I pipe a single number to get a list?

  27. 27

    How do I get a number of items in a filtered list?

  28. 28

    How do i get position instead of swapping in list number in python

  29. 29

    how to get just the value of a list in another list?

HotTag

Archive