Python Forum
What data structure I need
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What data structure I need
#4
data_test is data frame. data_test.loc[dates] is data frame too. So, you need to insert array of data frames into column (moreover, of the original data frame). This will consume a lot of memory,
at least. You can store obtained data frames in another list. Another way is to save only indices, e.g.
data_test.loc[dates].index.tolist(). Or, may be, I misunderstood something...Try this:


# somewhere before while loop:
data_test_ = data_test.copy()

# in the while loop, instead of `print(data_test...)`
data_test_.loc[end, 'NEW_COLUMN'] = data_test.loc[dates].index.tolist()
# or even
data_test_.loc[end, 'NEW_COLUMN'] = data_test.loc[dates]

# Finally, outside while loop:
data_test = data_test_
Reply


Messages In This Thread
What data structure I need - by dervast - Apr-04-2019, 05:22 PM
RE: What data structure I need - by scidam - Apr-06-2019, 10:56 AM
RE: What data structure I need - by dervast - Apr-06-2019, 03:45 PM
RE: What data structure I need - by scidam - Apr-07-2019, 11:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Data structure question standenman 1 654 Jun-04-2023, 11:51 AM
Last Post: jefsummers
  Is there a better data structure than classes for a set of employes? Schlangenversteher 5 2,636 Feb-26-2020, 11:43 AM
Last Post: buran
  Data saving structure JosefFilosopio 0 2,131 May-04-2019, 10:48 AM
Last Post: JosefFilosopio
  Replacing values for specific columns in Panda data structure Padowan 1 14,687 Nov-27-2017, 08:21 PM
Last Post: Padowan

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020