I was doing the PCA stuff, and there are 8 columns that are [ "Price", "Earnings/Share", "Book Value", "52 week low", "52 week high", "Market Cap", "EBITDA", "Price/Sales".]
sp_data = pd.DataFrame(scale(SP.iloc[:, 3:11]), index=SP.Symbol, columns=SP.columns[3:11])
this is the code that to pick out all columns in the first row, and I only want to pick out the "price", "earnings/share", "market cap", and "EBITDA", what shoud I enter in the [], or some other way to let it work, please give me some hit, thank you so much
Use:
new_df = df[['price', 'earnings/share', 'market cap', 'EBITDA']]
Although, I am sure this is a duplicate question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With