Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
minor corrections
Source Link
piet.t
  • 11.9k
  • 21
  • 45
  • 56

I need to read columns of complex numbers in the format:

# index; (real part, imaginary part); (real part, imaginary part) 1 (1.2, 0.16) (2.8, 1.1) 2 (2.85, 6.9) (5.8, 2.2) 

NumPy NumPy seems great for reading in columns of data with only a single delimiter, but the parenthesis seem to ruin any attempt at using numpy.loadtxt().

Is there a clever way to read in the file with Python, or is it best to just read the file, remove all of the parenthesis, then feed it to NumPy? Is there a clever way to read in the file with Python, or is it best to just read the file, remove all of the parenthesis, then feed it to NumPy?

This will need to be done for thousands of files so I would like an automated way, but maybe NumPyNumPy is not capable of this.

I need to read columns of complex numbers in the format:

# index; (real part, imaginary part); (real part, imaginary part) 1 (1.2, 0.16) (2.8, 1.1) 2 (2.85, 6.9) (5.8, 2.2) 

NumPy seems great for reading in columns of data with only a single delimiter, but the parenthesis seem to ruin any attempt at using numpy.loadtxt().

Is there a clever way to read in the file with Python, or is it best to just read the file, remove all of the parenthesis, then feed it to NumPy?

This will need to be done for thousands of files so I would like an automated way, but maybe NumPy is not capable of this.

I need to read columns of complex numbers in the format:

# index; (real part, imaginary part); (real part, imaginary part) 1 (1.2, 0.16) (2.8, 1.1) 2 (2.85, 6.9) (5.8, 2.2) 

NumPy seems great for reading in columns of data with only a single delimiter, but the parenthesis seem to ruin any attempt at using numpy.loadtxt().

Is there a clever way to read in the file with Python, or is it best to just read the file, remove all of the parenthesis, then feed it to NumPy?

This will need to be done for thousands of files so I would like an automated way, but maybe NumPy is not capable of this.

minor corrections
Source Link

How to read complex numbers from file with numpyNumPy?

I need to read columns of complex numbers in the format:

# index; (real part, imaginary part); (real part, imaginary part)     1  (1.2, 0.16)  (2.8, 1.1)  2  (2.85, 6.9)  (5.8, 2.2) 

numpyNumPy seems great for reading in columns of data with only a single delimiter, but the parenthesis seem to ruin any attempt at using numpynumpy.loadtxt().loadtxt()

Is there a clever way to read in the file with python, or is it best to just read the file, remove all of the parenthesis, then feed it to numpy?Is there a clever way to read in the file with Python, or is it best to just read the file, remove all of the parenthesis, then feed it to NumPy?

This will need to be done for thousands of files so I would like an automated way, but maybe numpyNumPy is not capable of this.

How to read complex numbers from file with numpy?

I need to read columns of complex numbers in the format:

# index; (real part, imaginary part); (real part, imaginary part) 1 (1.2,0.16) (2.8,1.1) 2 (2.85,6.9) (5.8,2.2) 

numpy seems great for reading in columns of data with only a single delimiter, but the parenthesis seem to ruin any attempt at using numpy.loadtxt()

Is there a clever way to read in the file with python, or is it best to just read the file, remove all of the parenthesis, then feed it to numpy?

This will need to be done for thousands of files so I would like an automated way, but maybe numpy is not capable of this.

How to read complex numbers from file with NumPy?

I need to read columns of complex numbers in the format:

# index; (real part, imaginary part); (real part, imaginary part)     1  (1.2, 0.16)  (2.8, 1.1)  2  (2.85, 6.9)  (5.8, 2.2) 

NumPy seems great for reading in columns of data with only a single delimiter, but the parenthesis seem to ruin any attempt at using numpy.loadtxt().

Is there a clever way to read in the file with Python, or is it best to just read the file, remove all of the parenthesis, then feed it to NumPy?

This will need to be done for thousands of files so I would like an automated way, but maybe NumPy is not capable of this.

Source Link
f4hy
  • 1.3k
  • 4
  • 15
  • 18

How to read complex numbers from file with numpy?

I need to read columns of complex numbers in the format:

# index; (real part, imaginary part); (real part, imaginary part) 1 (1.2,0.16) (2.8,1.1) 2 (2.85,6.9) (5.8,2.2) 

numpy seems great for reading in columns of data with only a single delimiter, but the parenthesis seem to ruin any attempt at using numpy.loadtxt()

Is there a clever way to read in the file with python, or is it best to just read the file, remove all of the parenthesis, then feed it to numpy?

This will need to be done for thousands of files so I would like an automated way, but maybe numpy is not capable of this.