Need to learn python to do some data manipulation.
When I read the documents, the documents out there are written in such a great skill so that I get very frustrating with some hidden message -_- for instance:
1. in official Python Documents:
random.sample(population, k)
http://ift.tt/1Ng9PWd
Question: What is population? What type of it? According to the following, it seems that it is a list? So, is it the only valid type that the functions receive?
2. in official Numpy Documents:
numpy.random.random_sample
http://ift.tt/1p8iBKq
The title is numpy.random.random_sample(size=None), and the following paragraph said that
size: int or tuple of ints, optional Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn.
Question: What does it mean? So, there are actually 2 parameters, 1st one is size, and the 2nd one is the shape and it is optional? So if I want to pass in 2 parameters, should I write "random.random_sample(5,[m,n,k])" or "random.random_sample(5, m, n k)"?
These documents are very brief and the author seems very shy to demo the usage of the library. It seems that they always try to hide something from us. I wonder if there are some python-customs that I should learn to understand all these magic? This is why I like the strong-typed languages, even the documents is brief, we can figure out how to use a class by ourselves.
- I want to generate some random float number within a range and with a finite quantity, as far as I can see, I can mix the random.uniform() and a loop to create my own function. Is there a library which can do it and with a well written documents?
Aucun commentaire:
Enregistrer un commentaire