Python Forum
insert into python DF by position - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: insert into python DF by position (/thread-20983.html)



insert into python DF by position - Johnse - Sep-09-2019

Hello,

Can someone show me example on how to insert values store in variable into python data frame by position ?

Thank you


RE: insert into python DF by position - perfringo - Sep-11-2019

There is lot of ambiguity in this question. However, simple example how to 'insert' sequence elements into dataframe:

>>> import pandas as pd
>>> letters = ['a', 'b', 'c']
>>> df = pd.DataFrame({'chars': letters})
>>> df
    chars
0	    a
1	    b
2	    c