Home > front end >  Delete the Merged column in pandas
Delete the Merged column in pandas

Time:05-25

enter image description here

I want to delete The first column and select the close price i.e It have 0 columns

Or How I can select the close price Column

CodePudding user response:

Not sure what is the question you are asking because you mention a merged column. In general, to select a close column you do df['close']. To drop a unix column df.drop('unix',axis=1).

UPDATE: The actual problem was that the csv file header was in the second row, with some garbage at the first row. When reading this csv file the location of header need to be specified explicitly, like that pd.read_csv('Binance_AAVEUSDT_d.csv',header=1).

After that columns name are correct and all works as expected

CodePudding user response:

Use:

import pandas as pd
data = pd.read_csv('Binance_AAVEUSDT_d.csv')
data = data.reset_index()
ndata = data.iloc[1:]
ndata.columns = data.iloc[0]
ndata['close']

Output:

1      100.30000000
2       99.30000000
3       94.10000000
4       91.30000000
5       90.20000000
           ...     
582          32.135
583          36.075
584          40.795
585          41.393
586          39.390
Name: close, Length: 586, dtype: object
  • Related