import pandas as pd import numpy as np import matplotlib.pyplot as plt import os from google.colab import drive drive.mount('/content/drive') os.chdir('/content/drive/My Drive/Colab Notebooks/ase3001') df = pd.read_csv('kfxsim.csv', delimiter=',') print(df.shape) # show the size of the dataframe df.head(10) # show the first 10 rows list(df) plt.figure() plt.plot(df['Time'], df['Yaw']) plt.plot(df['Time'], df['Pitch']) plt.plot(df['Time'], df['Roll']) plt.grid(True) plt.legend() plt.xlabel("Time (s)") plt.ylabel("Euler angles (deg)") plt.title("Euler angles") df = pd.read_csv('https://web.stanford.edu/~hastie/Papers/LARS/diabetes.data', delimiter='\t') df df.loc[df['AGE'].idxmin()] df['BMI'].mean() np.mean(df['BMI']) plt.figure(figsize=(12,8)) plt.plot(df['BP'], df['BMI'], 'o', alpha=0.5) plt.xlabel('BP') plt.ylabel('BMI') plt.grid(True) df = pd.read_json('http://jonghank.github.io/ee370/files/speeches.json') df print(f"parties: {df['parties'][0]}") print(f"speeches: {df['speeches'][0]}") from PIL import Image import requests X = Image.open(requests.get("https://jonghank.github.io/ase3001/files/aerospace_building.png", stream=True).raw) ae_building = np.array(X)/255 plt.figure(dpi=100) plt.imshow(ae_building) plt.axis('off') plt.title('Original color image') ae_building.shape R_channel = ae_building[:,:,0] G_channel = ae_building[:,:,1] B_channel = ae_building[:,:,2] ae_grayscale = 0.299*R_channel + 0.587*G_channel + 0.114*B_channel plt.figure(dpi=100) plt.imshow(ae_grayscale, cmap='gray') plt.axis('off') plt.title('Grayscale image')