I am trying to read the csv file using pandas, while reading I want to read only few rows and few columns for that I can pass all the arguments like skiprows, nrows inside pd.read_csv. But I don't want to do this way I want to create a separate function and pass this function to pd.read_csv as shown below. Can anyone tell me how to achieve this.
import pandas as pd
file = r'C:\Users\Desktop\raw_data\Parameters.csv'
def readheader():
parse_config
{
'nrows': 200,
'header': [1,4],
'skip_blank_lines': True
}
df = pd.read_csv(file, **parse_config)
print(df)
df.head()