def getPredictedPriceNormalized(self): # get model first self.getModelFromFilePath(self, self.file) input_features = self.df.iloc[:, [2, 3]].values input_data = input_features predicted_value = self.model.predict(self.X_test) plt.figure(figsize=(100, 40)) plt.plot(predicted_value, color='red') plt.plot(input_data[self.lookback:self.test_size + (2 * self.lookback), 1], color='green') plt.title("Opening price of stocks sold") plt.xlabel("Time (latest-> oldest)") plt.ylabel("Stock Opening Price") plt.show() self.sc.inverse_transform(input_features[self.lookback:self.test_size + (2 * self.lookback)]) return predicted_value
def plot_square_piece_simple(): """simple demo - makes more sense for a 'cut' to be the next level of abstraction after an 'edge' though""" pset = get_default_nub_parameters() pset.randomize() bxy, _ = create_puzzle_piece_edge(pset) pset.randomize() txy, _ = create_puzzle_piece_edge(pset) pset.randomize() lxy, _ = create_puzzle_piece_edge(pset) pset.randomize() rxy, _ = create_puzzle_piece_edge(pset) fig = plt.figure() fig.add_subplot(111, aspect='equal') plt.plot(bxy[:, 0], random_sign() * bxy[:, 1], 'k-') plt.plot(txy[:, 0], random_sign() * txy[:, 1] + 1, 'k-') plt.plot(random_sign() * lxy[:, 1], lxy[:, 0], 'k-') plt.plot(random_sign() * rxy[:, 1] + 1, rxy[:, 0], 'k-') plt.show()
class GuyMagen(): def __init__(self): self.penisSize = 0 self.favoriteRabi = 'kanievski' def __repr__(self): print('<=====3') def didGuyKillRabin(self): return True guyMagen = 0 import matplotlib.pyploy as plt x = [i for i in range(guyMagen,20)] y = [a**2 fro a in x] plt.plot(x,y)
import csv open_file = open("sitka_weather_07-2018_simple.csv", "r") csv_file = csv.reader(open_file, delimiter=",") header_row = next(csv_file) ''' print(header_row) for index, column_header in enumerate(header_row): print(index,column_header) ''' highs = [] for row in csv_file: highs.append(int(row[5])) print(highs) import matplotlib.pyploy as plt plt.plot(highs, c="red") plt.title("Daily High Temp, July 2018", fontsize=16) plt.xlabel("") plt.ylabel("Temperature (F)", fontsize=16) plt.tick_params(axis="both", which="major", labelsize=16) plt.show()
high = int(row[4]) low = int(row[5]) current_date= datetime.strptime(row[2],'%Y-%m-%d') except ValueError: print(f"Missing data for {current_date}") else: lows.append(int(row[5])) highs.append(int(row[4])) dates.append(current_date) import matplotlib.pyploy as plt fig= plt.figure() plt.plot(dates, highs, c="red",alpha=0.5) plt.plot(dates, lows, c="blue", aplha=0.5) plt.title("Daily high and low temperatures- 2018\nDeath Valley", fontsize=16) plt.xlabel("", fontsize=12) plt.fill_between(dates, highs, lows, facecolor= 'blue', alpha=0.1) fig.autofmt_xdate() plt.ylabel("Temperature (F)", fontsize=16) plt.tick_params(axis="both", labelsize=16) plt.show()
import csv import matplotlib.pyploy as plt games = [] record = [] wins = 0 f = open('cardinals34.csv') for row in csv.reader(f): if not row[0].isdigit(): continue if row[6].startswith('W') and row[13] == "Dean": wins += 1 games.append(int(row[0])) record.append(wins) plt.title('Dean Brothers progress toward 49 wins') plt.xlabel('Game number') plt.ylabel('Win count') plt.plot(games, record, 'r+') plt.savefig(games.pdf)
import numpy as np import matplotlib.pyploy as plt import time import Save as sv #Creo el objetos: generador = gf.GeneradorFunciones() osciloscopio = osc.Osciloscopio() frec = [] vpp = [] for i in range(10): generador.SetFrequency(str(i)) #No se si esto lo va a leer porque no se bien los parametros de la clase. vpp = vpp.append(osciloscopio.ReadVoltage()) #hay que ver que mide ymult para hacer la cuenta ahi y que devuelva Vpp. frec = frec.append(i) time.sleep(1) #Guardo los datos en un txt f = save('frecuencia.txt', frec) f.open() v = save.('vpp.txt', vpp) v.open() #Plot plt.plot(f,v, 'ro') plt.show()
x= datetime.strptime('2018-07-01','%Y-%m-%d') print(x) for row in csv_file: highs.append(int(row[5])) the_date= datetime.strptime(row[2],'%Y-%m-%d') dates.append(the_date) import matplotlib.pyploy as plt fig= plt.figure() plt.plot(dates, highs, c="red") plt.title("Daily High Temp, July 2018", fontsize=16) plt.xlabel("") plt.ylabel("Temperature (F)", fontsize=16) plt.tick_params(axis="both", labelsize=16) fig.autofmt_xdate() plt.show()