Category : for-loop

I wanted to print out datas until list_3 is ended. But, no matter how I tried, I only got last result of list_3. Here’s my code: import FinanceDataReader as fdr import numpy as np from numpy import NaN import pandas as pd import openpyxl …. pd.options.display.float_format = ‘{:.5f}’.format file_list = os.listdir(‘/home/sejahui/projects/stock_data_excel’) list_1 = [] list_2 ..

Read more

I have data_A which has columns level,hyumgi,hogi1, and hogi3… There are more columns, but these are the variables that I’m interested in. levelindicates the cycle , so for example it has the values from 0 to 100. If the level is 0, it means that it is the first cycle. If the level is 1, ..

Read more

Beginner to Programming My code is below , the spaces within diamond is shown with ‘B’ and spaces outside diamond are shown with X. n=5 for i in range(n): for j in range(n,i,-1): if j==i+1: print(‘*’,end=”) break print(‘X’,end=”) for j in range(i): print(‘B’,end=”) for j in range(i+1): if i==0: continue if j==i-1: print(‘*’,end=”) break print(‘B’,end=”) ..

Read more

Can someone tell me why this is happening? There are 11 column headers and 11 elements in the set ‘Xnew_values’!! Xnew = [[7.4, 0.88, 0.01, 4.1, 0.065, 18.0, 43, 0.9978, 3.31, 0.50, 9.44]] Xnew_values = [7.4, 0.88, 0.01, 4.1, 0.065, 18.0, 43, 0.9978, 3.31, 0.50, 9.44] Xnew = sc.transform(Xnew) yrfc_new = rfc_wine.predict(Xnew) yclf_new = clf_wine.predict(Xnew) ..

Read more

I am trying to loop though a string and convert underscores to camel case. Example) my_string –> myString I have posted my working code below. Can someone help me figure out the hole in my logic? def to_camel_ca (string): camel_string = "" for i in range(len(string)): if string[i] == ‘_’: camel_string = camel_string + string[i ..

Read more