This question might seems easy but I could not find any solution for it.
Say I have a CSV file like this without headers.
121
334
313
930
I want to add/append new row with number 0 at the bottom like this
121
334
313
930
0
I tried with the following method but did not succeed.
import pandas as pd
import os
folder_path = "/home/Ling/test/"
df = pd.read_fwf(folder_path + "test1.csv", usecols=[0], delimiter=",")
df2 = pd.DataFrame([[0]], dtype=int)
print df.append(df2, ignore_index=True)
The result
NaN 121
NaN 334
NaN 313
NaN 930
0.0 NaN
I am following this example
I even try to change from [[0]] to [[0,]] and [[,0]] but did not work.
Is there anything that I miss here in the code?
Thank you for your help and suggestion.