Пользователь № 11 аудитории К-522 2 недель назад
Родитель 80b9b9d9de
Сommit d9d5f10bf2

@ -269,4 +269,100 @@ time.struct_time(tm_year=2025, tm_mon=10, tm_mday=19, tm_hour=16, tm_min=21, tm_
В развернутой версии Python должны быть установлены модули пакета matplotlib, в состав которого входит модуль pylab, содержащий ряд полезных вычислительных функций и графических возможностей.
Импорт модуля инструкции
```py
import matplotlib
import pylab
x=list(range(-3,55,4))
t=list(range(15))
pylab.plot(t,x)
[<matplotlib.lines.Line2D object at 0x000001BC059DA5D0>]
pylab.title('Первый график')
Text(0.5, 1.0, 'Первый график')
pylab.xlabel('время')
Text(0.5, 0, 'время')
pylab.ylabel('сигнал')
Text(0, 0.5, 'сигнал')
pylab.show()
```
![2](ris/ris1.png)
```py
X1=[12,6,8,10,7]; X2=[5,7,9,11,13]
pylab.plot(X1)
[<matplotlib.lines.Line2D object at 0x000001BC05A8D590>]
pylab.plot(X2)
[<matplotlib.lines.Line2D object at 0x000001BC05A8D6D0>]
pylab.show()
```
![3](ris/ris2.png)
```py
# Круговая диаграмма:
region=['Центр','Урал','Сибирь','Юг']
naselen=[65,12,23,17]
pylab.pie(naselen,labels=region)
([<matplotlib.patches.Wedge object at 0x00000158DBCC8820>, <matplotlib.patches.Wedge object at 0x00000158DBCC8760>, <matplotlib.patches.Wedge object at 0x00000158DBCC8FD0>, <matplotlib.patches.Wedge object at 0x00000158DBCDE490>], [Text(-0.1910130855889933, 1.083288512416601, 'Центр'), Text(-0.8613283319035216, -0.6841882085072037, 'Урал'), Text(0.04429273729355889, -1.0991078898011077, 'Сибирь'), Text(0.9873752043868569, -0.4848610169543564, 'Юг')])
pylab.show()
```
![4](ris/ris3.png)
```py
c1 = [10,1,1000,843,2837, 34,34,65]; c2 = [10,51046,54,46,1, 1535, 7, 12435]
plt.bar(c1, c2)
<BarContainer object of 8 artists>
pylab.show()
```
![5](ris/ris4.png)
```py
x1 = ['f', 'c', 'y']
x2 = [12, 4, 24]
plt.bar(x1, x2)
<BarContainer object of 3 artists>
pylab.show()
```
![6](ris/ris5.png)
## 8. Статистический модуль statistics
```py
dir(s)
['Counter', 'Decimal', 'Fraction', 'NormalDist', 'StatisticsError', '__all__',
'__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__',
'__package__', '__spec__', '_coerce', '_convert', '_exact_ratio', '_fail_neg',
'_find_lteq', '_find_rteq', '_isfinite', '_normal_dist_inv_cdf', '_ss', '_sum',
'bisect_left', 'bisect_right', 'erf', 'exp', 'fabs', 'fmean', 'fsum', 'geometric_mean',
'groupby', 'harmonic_mean', 'hypot', 'itemgetter', 'log', 'math', 'mean', 'median',
'median_grouped', 'median_high', 'median_low', 'mode', 'multimode', 'numbers', 'pstdev',
'pvariance', 'quantiles', 'random', 'sqrt', 'stdev', 'tau', 'variance']
data = [10, 20, 30, 40, 50]
s.mean(data)
30
s.median(data)
30
s.stdev(data)
15.811388300841896
s.variance(data)
250
data = [10, 56, 73, 7, 20, 30, 40, 50, 56, 77, 3]
s.quantiles(data)
[10.0, 40.0, 56.0]
```
## 9. Завершили сеанс работы

Загрузка…
Отмена
Сохранить