Python Forum
Populating an array dynamically
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Populating an array dynamically
#1
Hi guys - am new to Python, so if my questions seem basic, pls bear with me.

I have a script which returns rows of data in this format :

20220517 09:10:00 147
20220517 09:20:00 147
20220517 09:30:00 148
20220517 09:40:00 148
20220517 09:50:00 145

I get this output with the following bit of code :

class IBapi(EWrapper, EClient):
def __init__(self):
EClient.__init__(self, self)

def historicalData(self, reqId, bar):
print(f'{bar.date} {round(bar.close)}')


I want to store this data in an array (3 columns and not sure how many rows there will be).
FYI, the first column is the date (2022-May-17), the second is the time, and the third is the price.

What is the best way to do this in Python?

Cheers
Reply
#2
Pandas. It has something called a Dataframe that works very well with columnar data.
zxcv101 likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Dynamically allocated array JESuh 1 946 Jun-29-2022, 10:53 AM
Last Post: Larz60+
  Loop through array items dynamically in a certain format bhojendra 3 2,653 Jun-11-2019, 03:37 AM
Last Post: micseydel
  Populating a timetable with subjects brittocj 1 1,808 May-02-2019, 07:00 AM
Last Post: buran
  Populating Array2 from Array1 PappaBear 1 2,064 Aug-22-2018, 04:30 AM
Last Post: PappaBear
  Populating a list with divisors RedSkeleton007 1 2,180 Aug-21-2018, 12:52 AM
Last Post: Larz60+
  populating csv and searching the file mepyyeti 1 2,963 Apr-26-2018, 03:02 AM
Last Post: woooee
  for loop and list populating mepyyeti 3 3,463 Apr-12-2018, 03:06 AM
Last Post: buran
  Importing file in dataframe and populating missing column name vvv 1 3,461 Feb-26-2017, 02:32 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

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