Convert DataFrame string complex i to j python // “Cloning” row or column vectors

时间:2024-06-16 14:03:26

https://*.com/questions/30808286/convert-dataframe-string-complex-i-to-j-python

https://*.com/questions/1550130/cloning-row-or-column-vectors

If you have a string like this: complexStr = "0.015291+0.0075383i", you could do:

complexFloat = complex(complexStr[:-1] + 'j')

Use numpy.tile:

>>> tile(array([1,2,3]), (3, 1))
array([[1, 2, 3],
[1, 2, 3],
[1, 2, 3]])

or for repeating columns:

>>> tile(array([[1,2,3]]).transpose(), (1, 3))
array([[1, 1, 1],
[2, 2, 2],
[3, 3, 3]])