R
Add one line in DataFrame easily using df.loc[len(df)] = [...]:In [9]: df
Out[9]:
ID Name First name Middle name Age Floor Weight Growth Family status
0 1 Name Yrij V 29 2 80 185 married
In [10]: df.loc[len(df)] = [61, 'Василий', 'Флешков', 'Капустович', 512,'муж', 111, 121, 'х' ]
In [11]: df
Out[11]:
ID Name First name Middle name Age Floor Weight Growth Family status
0 1 Name Yrij V 29 2 80 185 married
1 61 Василий Флешков Капустович 512 муж 111 121 х
but it is much more efficient to build a set of lines and immediately create a ready DataFrame or create a new one and add it to the existing:In [12]: d = [[11, 'Bond', 'James', 'Jnr', 35, 'M', 85, 190, ''],
...: [12, 'Kong', 'King', '', 12, 'M', 2000, 600, '']
...: ]
...:
In [13]: new = pd.DataFrame(d, columns=df.columns)
In [14]: new
Out[14]:
ID Name First name Middle name Age Floor Weight Growth Family status
0 11 Bond James Jnr 35 M 85 190
1 12 Kong King 12 M 2000 600
In [15]: df = df.append(new)
In [16]: df
Out[16]:
ID Name First name Middle name Age Floor Weight Growth Family status
0 1 Name Yrij V 29 2 80 185 married
1 61 Василий Флешков Капустович 512 муж 111 121 х
0 11 Bond James Jnr 35 M 85 190
1 12 Kong King 12 M 2000 600
Well, actually, adding DataFrame to existing CSV file:df.to_csv(r'/path/to/file.csv', mode='a', header=None, index=False)
PS I would not consider the CSV file as an OBD file as a maximum as a time storage facility (e.g. for transfer (export/import) to another OBD. Try MySQL / SQLite or HDF (the fast file repository is convenient for processing and retrieval of Pandas)