Hi All,
I have to append multiple csv files while using pandas. I have to convert the data into desired datatype and then append but when i am doing this, i am getting an TypeError i.e.
Nidhesh
I have to append multiple csv files while using pandas. I have to convert the data into desired datatype and then append but when i am doing this, i am getting an TypeError i.e.
Error:TypeError: convert_data() missing 1 required positional argument: 'data'I am using below code :import pandas as pd
def convert_data (data):
for i in data:
df[i].dropna(inplace=True)
df[i]["CONSUMER_NO"] = df[i]["CONSUMER_NO"].astype(int)
df[i]["BUPC"] = df[i]["BUPC"].astype(int)
df[i]["DTC"] = df[i]["DTC"].astype(int)
df[i]["AREA"] = df[i]["AREA"].astype(str)
df[i]["ZONE"] = df[i]["AREA"].astype(str)
df[i]["METER_STATUS"] = df[i]["METER_STATUS"].astype(str)
return;
df0 = pd.read_csv("E:\\test10.csv",header=0,skiprows=0)
df1 = pd.read_csv("E:\\test11.csv",header=0,skiprows=0)
df2 = pd.read_csv("E:\\test12.csv",header=0,skiprows=0)
data = [df0,df1,df2]
#data_before = data.dtypes
convert_data()
data.append(df0,df1,df2)
dataMany thanks,Nidhesh
