eval.hist (alpha = 0.5)Math.sqrt (x) ` Np.array ([0, 1, 2]) ``evalUne soi-disant instruction d'affectation qui vous permet d'utiliser la chaîne de caractères à l'intérieur comme code avec eval (" ~~~ ")?
python
list = ["dog","cat"]
dog, cat = "wan", "nya"
for i in list:
print(eval(i))
# wan
# nya
.hist (alpha = 0.5).hist (alpha =?) Le rend transparent, 1 ~ 0 le rend plus sombre à mesure qu'il se rapproche de 1, et 0.0 le rend complètement transparent.
python
x = np.random.randn(10000)
plt.hist(x, alpha =0.5)
plt.hist(x - 2, alpha = 0.5)
plt.show

Math.sqrt (x)Je veux utiliser la racine carrée facilement! Dans ce cas, utilisez math to .sqrt (x)!
python
import math
print(math.sqrt(4))
print(math.sqrt(144))
# 2.0
# 12.0
Np.array ([0, 1, 2])En créant une liste avec np.array ([list of int]), vous pouvez appliquer le module numpy à la liste tel quel.
python
x = np.array([812, 973, 1001])
np.max(x)
# 1001
5.etc...
Recommended Posts