Home > database >  index=False not working due to which not able to use range in skiprow function
index=False not working due to which not able to use range in skiprow function

Time:12-06

I am working on pandas and trying to read a CSV located on my desktop. I actually need the following rows to be published in the defined data frame. Rows as per csv = [15,16,17,18,19, 21, 22,23,24] but as soon as i try to define a range to skip in pandas i start getting Nan Values in my output

import pandas as pd

data = pd.read_csv('C:\\Users\\Michael\\Desktop\\Tradition_Basis_RFR_2021_12_05_15_00_00.csv', header=0, skiprows=1, nrows=22)
df = pd.DataFrame(data, columns=['Name', 'Bid', 'Ask'])
df['Mid_value'] = df['Bid']/2   df['Ask']/2
print(df)

Script final result

  • Related