How to create an array containing strings with evenly spaced values in DolphinDB?

26 views Asked by At

I want to create an array containing strings in ascending order with evenly spaced values, such as “5s, 10s, 15s ... 60s“. In Python, I can use the following script:

time_intervals = [str(i) + 's' for i in range(5, 61, 5)]
print(time_intervals)
// ['5s', '10s', '15s', '20s', '25s', '30s', '35s', '40s', '45s', '50s', '55s', '60s']

Is there a simple way to achieve this in DolphinDB?

1

There are 1 answers

0
Hanwei Tang On

Almostly the same with Python:

each(i -> string(i) + "s", 1..12 * 5)