My code parses data from csv file, that is craeted in "correct" notation.
I have several tables as result, that were obtained by the columnnames of this csv file:
import pandas as pd
def parseColumnsByPandas(filePath):
col_names = ["Car","MPG","Cylinders","Displacement","Horsepower","Weight","Acceleration","Model","Origin"]
df = pd.read_csv(filePath,skiprows=1,names=col_names)
for column_name, column_data in df.iteritems():
un_df = sorted(column_data.unique())
res_df = pd.DataFrame(un_df,columns = [f'{column_name}'])
print(res_df)
res_df.to_csv(f"D:\\out\\unique_{column_name}.csv")
filePath = r"D:/out/cars_norm.csv"
parseColumnsByPandas(filePath)
How could I get Id in the first column as a header and numeration, that begins from 1 not from zero?