When saving the data to csv, data.to_csv(\'csv_data\', sep=\',\', encoding=\'utf-8\', header= False, index = False), it creates a blank line at the end of csv f
One way would be to save data except the last entry,with default line_terminator(\n) and append the last line with line_terminator="" .
data1 = data.iloc[0:len(data)-1]
data2 = data.iloc[[len(data)-1]]
data1.to_csv('csv_data', sep=',', encoding='utf-8', header= False, index = False)
data2.to_csv('csv_data', sep=',', encoding='utf-8', header= False, index = False,mode='a',line_terminator="")