eval
.hist (alpha = 0.5)
`math.sqrt (x)`
np.array ([0, 1, 2])
`eval
A so-called assignment statement that can use the character string inside as a code with eval ("~~~ ")
?
python
list = ["dog","cat"]
dog, cat = "wan", "nya"
for i in list:
print(eval(i))
# wan
# nya
.hist (alpha = 0.5)
.hist (alpha =?)
Makes it transparent, 1 ~ 0
makes it darker as it gets closer to 1
, and 0.0
makes it completely 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)
I want to use the square root easily! In such a case, use math
to.sqrt (x)
!
python
import math
print(math.sqrt(4))
print(math.sqrt(144))
# 2.0
# 12.0
Np.array ([0, 1, 2])
By creating a list with np.array ([list of int])
, you can apply the numpy module to the list as it is.
python
x = np.array([812, 973, 1001])
np.max(x)
# 1001
5.etc...
Recommended Posts