2

I have list lst = ['vk.com', 'facebook.com', 'avito.ru', 'twitter.com'] and I want to add it to this df:

date    id  request
2016-06-17 09:26:18 [email protected]    GET HTTP/1.1
2016-06-17 09:38:18 [email protected]    GET HTTP/1.1
2016-06-17 10:13:44 [email protected]    GET HTTP/1.1
2016-06-17 10:19:24 [email protected]    GET HTTP/1.1

I try df.append, but it doesn't work.

1 Answer 1

4

If length of list is same as length of df use:

lst = ['vk.com', 'facebook.com', 'avito.ru', 'twitter.com']
df['new'] = lst

print (df)
                  date                    id       request           new
0  2016-06-17 09:26:18  [email protected]  GET HTTP/1.1        vk.com
1  2016-06-17 09:38:18  [email protected]  GET HTTP/1.1  facebook.com
2  2016-06-17 10:13:44  [email protected]  GET HTTP/1.1      avito.ru
3  2016-06-17 10:19:24  [email protected]  GET HTTP/1.1   twitter.com
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.