{"action":"created","issue":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/14835","repository_url":"https://api.github.com/repos/pandas-dev/pandas","labels_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14835/labels{/name}","comments_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14835/comments","events_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14835/events","html_url":"https://github.com/pandas-dev/pandas/issues/14835","id":194445753,"number":14835,"title":"Efficient way to create a DataFrame iteratively","user":{"login":"MartinPyka","id":8008840,"avatar_url":"https://avatars.githubusercontent.com/u/8008840?v=3","gravatar_id":"","url":"https://api.github.com/users/MartinPyka","html_url":"https://github.com/MartinPyka","followers_url":"https://api.github.com/users/MartinPyka/followers","following_url":"https://api.github.com/users/MartinPyka/following{/other_user}","gists_url":"https://api.github.com/users/MartinPyka/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinPyka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinPyka/subscriptions","organizations_url":"https://api.github.com/users/MartinPyka/orgs","repos_url":"https://api.github.com/users/MartinPyka/repos","events_url":"https://api.github.com/users/MartinPyka/events{/privacy}","received_events_url":"https://api.github.com/users/MartinPyka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-08T21:11:59Z","updated_at":"2016-12-08T22:44:57Z","closed_at":null,"body":"I am working on a financial simulation ([financial_life](https://github.com/MartinPyka/financial_life)), in which I would like to collect my timeseries data in a DataFrame during simulation. However, while looking through several posts on StackOverflow and experimenting with timeit, I noticed that appending data to a Dataframe (e.g. via append or via loc-expansion) is far more inefficient than the append-function for a simple list and then transforming everything to a dataframe, if requested. The latter one is, what I am doing now.\r\n\r\nSo I was wondering, whether there is any performant way of creating a DataFrame in an iterative manner?"},"comment":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/comments/265878431","html_url":"https://github.com/pandas-dev/pandas/issues/14835#issuecomment-265878431","issue_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14835","id":265878431,"user":{"login":"jorisvandenbossche","id":1020496,"avatar_url":"https://avatars.githubusercontent.com/u/1020496?v=3","gravatar_id":"","url":"https://api.github.com/users/jorisvandenbossche","html_url":"https://github.com/jorisvandenbossche","followers_url":"https://api.github.com/users/jorisvandenbossche/followers","following_url":"https://api.github.com/users/jorisvandenbossche/following{/other_user}","gists_url":"https://api.github.com/users/jorisvandenbossche/gists{/gist_id}","starred_url":"https://api.github.com/users/jorisvandenbossche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jorisvandenbossche/subscriptions","organizations_url":"https://api.github.com/users/jorisvandenbossche/orgs","repos_url":"https://api.github.com/users/jorisvandenbossche/repos","events_url":"https://api.github.com/users/jorisvandenbossche/events{/privacy}","received_events_url":"https://api.github.com/users/jorisvandenbossche/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T22:44:57Z","updated_at":"2016-12-08T22:44:57Z","body":"Exactly what you are doing, append to a list and then transforming to a dataframe at the end. Is this not working for you? \r\nAnother option would be to allocate the DataFrame from the start and fill it, but then you need to know its size of course"}}
{"actor":{"display_login":"jorisvandenbossche"}}