Issue 1:
Hi there!

I am using an anaconda 4.3.18 64 bits installation on windows 7. the version of python is 3.6.1 and numpy version is 1.12.1

I imported an ascii file, and ran these commands:

import numpy as np

read the ascii file into attribute variable

sorted_items= np.sort(attribute, axis=0)

sorted_ids= np.argsort(attribute,axis=0)

Then, I exported sorted_items and sorted_ids to an ASCII file.

Thereafter, I imported the same file in Octave version 4.2.0 64 bits and ran this command:

[sorted_items,sorted_ids]= sort(attribute)

Also, I exported the outputs to an ASCII file.

When I compared these outputs, I noticed the following:

The sorted values in Python match those in Octave

The sorted index show issues. The index reported by numpy are different to those reported by Octave in many places (see the excell spreadsheet, rows with blue background)

The sorted index show some good matches. A good index match is when the Octave index is one value higher than the one for Python (because Octave starts counting from 1, instead of 0 for Python)

I attached to this issue two files: the excell spreadsheet, and the text file containing the data used to report this issue.

Many thanks,

Ivan

Data.zip

Issue 2:
Describe the issue:

Describe your issue.

From the attached CSV file, input_data.csv, I import the, say, test_list. Then, I create a pd.Dataframe to store my data in test_df.

from scipy import fft
import numpy as np

test_df = pd.DataFrame(index=range(len(test_list)), columns=['test'])
test_df['test'] = test_list

I want to calculate the FFT transform of the signal in test_df['test']. However, I get different results when I pass as input different types of arguments to the scipy.fft.fft().

Once I pass the signal as a nympy.array I get the plot #1.

Once I pass the signal as a pd.Dataframe I get the plot #2.

Both inputs, np.array and pd.DataFrame contain the same information.

From the problem definition the plot#2 seems to have a better physical interpretation.

However, it is not clear why I get different results.

May be it is a bug?

The code I use is below:

from scipy import fft
import numpy as np

test_df = pd.DataFrame(index=range(len(test_list)), columns=['test'])
test_df['test'] = test_list

########## PLOT 1: from Numpy ##############

to_np = test_df['test'].to_numpy()
print(to_np)

fft_output = fft.fft(to_np)
power = np.abs(fft_output)
freq = numpy.fft.fftfreq(len(to_np))

mask = freq >= 0
freq = freq[mask]
power = power[mask]

plt.plot(freq, power)
plt.show()

########## PLOT 2: from pd.DataFrame ##############

to_df = test_df['test'].to_frame()
print(to_df)

fft_output = numpy.fft.fft(to_df)
power = np.abs(fft_output)
freq = fft.fftfreq(len(to_df))

mask = freq >= 0
freq = freq[mask]
power = power[mask]

plt.plot(freq, power)
plt.show()

Reproduce the code example:

from scipy import fft
import numpy as np

test_df = pd.DataFrame(index=range(len(test_list)), columns=['test'])
test_df['test'] = test_list

########## PLOT 1: from Numpy ##############

to_np = test_df['test'].to_numpy()
print(to_np)

fft_output = fft.fft(to_np)
power = np.abs(fft_output)
freq = numpy.fft.fftfreq(len(to_np))

mask = freq >= 0
freq = freq[mask]
power = power[mask]

plt.plot(freq, power)
plt.show()

########## PLOT 2: from pd.DataFrame ##############

to_df = test_df['test'].to_frame()
print(to_df)

fft_output = numpy.fft.fft(to_df)
power = np.abs(fft_output)
freq = fft.fftfreq(len(to_df))

mask = freq >= 0
freq = freq[mask]
power = power[mask]

plt.plot(freq, power)
plt.show()

Error message:

No response

Runtime information:

1.23.5

3.9.16 | packaged by conda-forge | (main, Feb 1 2023, 21:38:11)

[Clang 14.0.6 ]

Context for the issue:

No response