Advertisement
mikolajmki

ai_lab02

Oct 13th, 2022
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. # This is a sample Python script.
  2.  
  3. # Press Shift+F10 to execute it or replace it with your code.
  4. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
  5. import numpy as np
  6. import pandas as pd
  7. import matplotlib.pyplot as plt
  8. import matplotlib.figure as fig
  9.  
  10. def zad1():
  11.     arr = np.array([[2,3,5,1],
  12.                    [3,5,7,2],
  13.                    [5,7,1,3]])
  14.     columnSum = arr.sum(0)
  15.     rowSum = arr.sum(1)
  16.  
  17.     arr1 = np.array([1,2,3,4,5,6])
  18.  
  19.     # print(columnSum, rowSum)
  20.  
  21.     arr1_0_1 = ((arr-arr.min(0)) / (arr.max(0)-arr.min(0)))
  22.  
  23.     arr_csv = pd.read_csv('dane.csv', ',', header=None)
  24.     nazwy_kolumn = list(arr_csv.columns)
  25.  
  26.     # print(arr1_0_1)
  27.     # print(arr_csv[1][1])
  28.  
  29.     x = np.arange(0, 10, 0.1)
  30.     y = np.sin(x)
  31.     # plt.scatter(x, y)
  32.     # plt.plot(x, y)
  33.     # plt.xlabel('x')
  34.     # plt.ylabel('y')
  35.     # plt.show()
  36.  
  37.     fig, ax = plt.subplots(1,2,figsize=(10,5))
  38.     # ax[0].plot(x,y)
  39.     # ax[0].set_xlabel('x')
  40.     # ax[0].set_ylabel('y')
  41.     # ax[1].scatter(x,y)
  42.     # ax[1].set_xlabel('x')
  43.     # ax[1].set_ylabel('y')
  44.     # fig.tight_layout()
  45.  
  46.     fig, ax = plt.subplots(2, 2, figsize = (10, 10))
  47.     ax[0, 0].scatter(x, y)
  48.     ax[0, 1].plot(x, y)
  49.     ax[1, 0].hist(y)
  50.     ax[1, 1].boxplot(y)
  51.  
  52.     plt.show()
  53.  
  54. zad1()
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement