I always convert the columns into floats, by
prices['Open'] = prices['Open'].apply(lambda x: float(x))
prices['Close'] = prices['Close'].apply(lambda x: float(x))
prices['High'] = prices['High'].apply(lambda x: float(x))
prices['Low'] = prices['Low'].apply(lambda x: float(x))
prices['Volume'] = prices['Volume'].apply(lambda x: float(x))
prices['Market cap'] = prices['Market cap'].apply(lambda x: float(x))
I want to be able to do this in one line, i tried using
prices[['Open', 'Close', 'High', 'Low', 'Volume', 'Market cap']] = prices[['Open', 'Close', 'High', 'Low', 'Volume', 'Market cap']].apply(lambda x: float(x))
but it gives me an error msg:
TypeError: cannot convert the series to <class 'float'>
any help will be appreciated!
prices[column_list] = prices[column_list].astype(float)