I can't completely understand your problem as your code is not formatted properly in your question but the error is just an expected datatype error.

You need to convert your dataframe to a np array. Just add .values at the end of your dataframe. So if your input was a sample dataframe like so:

df = pd.DataFrame({"Col1":[1,2,3,4], "Col2":[2,2,3,4]})

Convert the whole thing to a numpy array like so:

sample_array = df.values

or convert one column to a np array like so:

sample_array_2 = df["Col1"].values

Update: As mentioned in the comments, pandas recommends .to_numpy() instead, so use something like:

sample_array = df.to_numpy()
Answer from Shuvo Saha on Stack Overflow
🌐
GitHub
github.com › mrjbq7 › ta-lib › issues › 249
Got error "has incorrect type (expected numpy.ndarray, got DataFrame)" · Issue #249 · TA-Lib/ta-lib-python
January 3, 2019 - TypeError: Argument 'real' has incorrect type (expected numpy.ndarray, got DataFrame)
Author   AlexBThomsen
Discussions

How to add series to a dataframe with index as dates, but the series is shorter than dataframe.

Can you post the full traceback? It appears that your error isn't occurring in the code you posted as I don't see any argument called tuples.

I do see a possible problem that will be thrown later if the error isn't in the code you posted.

This line of code, is what's in the column Close also a Dataframe or structured data type? It appears you are trying to access df["Closes"][column name] new_df [t] = ema(6,df["Close"][t])

I'm a bit tired so I may have misunderstood what you're doing on this line.

More on reddit.com
🌐 r/learnpython
4
1
December 22, 2021
TypeError: expected np.ndarray (got numpy.ndarray)
Hi, don't know whether for the version of pytorch, I use torch=1.10. and happend to this error, please help me, thanks. File "E:\desktop\KG\NCRFpp\model\wordrep.py", line 45, in init ... More on github.com
🌐 github.com
13
August 9, 2019
python - Argument 'open' has incorrect type (expected numpy.ndarray, got DataFrame) - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Ask questions, find answers and collaborate at work with Stack Overflow for Teams More on stackoverflow.com
🌐 stackoverflow.com
[QST] TypeError: Argument 'real' has incorrect type (expected numpy.ndarray, got ndarray)
concurrent.futures.process._Re... self._exception TypeError: Argument 'real' has incorrect type (expected numpy.ndarray, got ndarray) ... Name: cudf-cu12 Version: 24.6.0 Summary: cuDF - GPU Dataframe Home-page: Author: NVIDIA Corporation Author-email: License: Apache 2.0 ... More on github.com
🌐 github.com
4
June 14, 2024
🌐
Finisky Garden
finisky.github.io › en › argument-incorrect-type-expected-ndarray
TypeError: Argument has incorrect type (expected numpy.ndarray, got DataFrame) Solution | Finisky Garden
November 2, 2024 - After upgrading packages in a conda env, talib cannot accept dataframe as input, the error message looks like TypeError: Argument 'xxx' has incorrect type (expected numpy.ndarray, got DataFrame): Trac
🌐
Reddit
reddit.com › r › learnpython › comments › rlx560 › how_to_add_series_to_a_dataframe_with_index_as
r/learnpython - How to add series to a dataframe with index as dates, but the series is shorter than dataframe.
December 22, 2021 -

I want to add a Series with index as date to a dataframe with an index as dates, but the Series is shorter than the dataframe. The dataframe will have a long list of dates as index and the series will have various starting points in the said dates depending upon the availability of data for that particular stock. My code gives me the following error:

TypeError: Argument 'tuples' has incorrect type (expected numpy.ndarray, got DatetimeArray)

My code is :

new_df = pd.DataFrame(index = df["Close"].index)for t in list(df["Close"].columns):new_df [t] = ema(6,df["Close"][t])return new_df

PS: ema is an exponential moving average function that I created. It gives out the said series with date index.

🌐
GitHub
github.com › jiesutd › NCRFpp › issues › 131
TypeError: expected np.ndarray (got numpy.ndarray) · Issue #131 · jiesutd/NCRFpp
August 9, 2019 - File "E:\desktop\KG\NCRFpp\model\wordrep.py", line 45, in init self.word_embedding.weight.data.copy_(torch.from_numpy(data.pretrain_word_embedding)) TypeError: expected np.ndarray (got numpy.ndarray) No one assigned · No labels · No labels · No projects ·
Author   Biaocsu
🌐
Stack Overflow
stackoverflow.com › questions › 66703261 › argument-open-has-incorrect-type-expected-numpy-ndarray-got-dataframe
python - Argument 'open' has incorrect type (expected numpy.ndarray, got DataFrame) - Stack Overflow
6 TypeError: 'numpy.ndarray' object is not callable when using pandas .values() 0 numpy.array: TypeError: 'DataFrame' object is not callable · 0 FileNotFoundError: [Errno 2] File b"stock_df · 1 FileNotFoundError: [Errno 2] File stock_dfs/BRK.B.csv does not exist: how to adjust code if file doesn't exist: 1 Pandas - EmptyDataError: No columns to parse from file when reading stock .csv file · 0 ParserError: Error tokenizing data. C error: Expected 1 fields in line 23 ·
🌐
GitHub
github.com › rapidsai › cudf › issues › 16029
[QST] TypeError: Argument 'real' has incorrect type (expected numpy.ndarray, got ndarray) · Issue #16029 · rapidsai/cudf
June 14, 2024 - concurrent.futures.process._Re... self._exception TypeError: Argument 'real' has incorrect type (expected numpy.ndarray, got ndarray) ... Name: cudf-cu12 Version: 24.6.0 Summary: cuDF - GPU Dataframe Home-page: Author: NVIDIA Corporation Author-email: License: Apache 2.0 ...
Author   blue-cat-whale
Find elsewhere
🌐
NVIDIA Developer Forums
forums.developer.nvidia.com › robotics & edge computing › jetson systems › jetson orin nx
TypeError: expected np.ndarray (got numpy.ndarray) - Jetson Orin NX - NVIDIA Developer Forums
July 1, 2024 - I am unable to run the python script the following error throwing when i try run the file: Traceback (most recent call last): File “/home/ubuntu/Downloads/SiamTrackers-master/NanoTrack/bin/demo.py”, line 143, in main() File “/home/ubuntu/Downloads/SiamTrackers-master/NanoTrack/bin/demo.py”, ...
🌐
QuantConnect
quantconnect.com › forum › discussion › 8047 › calculate-technical-indicators-every-period-using-ta-lib-package
Calculate technical indicators every period using ta_lib package - QuantConnect.com
Arguments: data: Slice object keyed by symbol containing the stock data ''' open_ = self.Securities["SPY"].Open high_ = self.Securities["SPY"].High low_ = self.Securities["SPY"].Low close_ = self.Securities["SPY"].Close volume_ = self.Securities["SPY"].Volume dema = DEMA(np.array(close_), 30) self.Debug(f'DEMA value is equal to: {dema}') If I ran this, it returns an error:Runtime Error: TypeError : Argument 'real' has incorrect type (expected numpy.ndarray, got NoneType) at OnData in main.py:line 81 TypeError : Argument 'real' has incorrect type (expected numpy.ndarray, got NoneType)
🌐
GitHub
github.com › pytorch › pytorch › issues › 135836
TypeError: expected np.ndarray (got numpy.ndarray) · Issue #135836 · pytorch/pytorch
September 12, 2024 - 🐛 Describe the bug Bug When I try to convert a numpy to torch tensor, I got the error TypeError: expected np.ndarray (got numpy.ndarray) How to reproduce import numpy as np import torch import torch.nn as nn x = np.array([[1, 2, 3, 4], [...
Author   yzhao30
🌐
PyTorch Forums
discuss.pytorch.org › t › typeerror-expected-np-ndarray-got-int › 116512
TypeError: expected np.ndarray (got int) - PyTorch Forums
March 30, 2021 - How is it possible to reshape the input which is a? I used a = a.view(1) and error still exist · No not to that large unless you want to copy it a bunch of times. If you want to do that and just copy the value to the shape you need you can do this: · I don’t fully understand the error ...
🌐
GitHub
github.com › atnlp › torchtext-summary › issues › 3
TypeError: expected np.ndarray (got numpy.ndarray) · Issue #3 · atnlp/torchtext-summary
August 7, 2019 - Please reload this page · ...错(如101版) TypeError: expected np.ndarray (got numpy.ndarray) 将torch.from_numpy()改为torch.Tensor()即可 ......
Author   BoKaiSun
🌐
Note.nkmk.me
note.nkmk.me › home › python › pandas
Convert between pandas DataFrame/Series and NumPy array | note.nkmk.me
January 24, 2024 - The pd.Series() constructor has a basic usage similar to pd.DataFrame(). A Series can be created by specifying a one-dimensional ndarray in the first argument. ... An error occurs for two-dimensional or higher arrays. a_2d = np.array([[1, 2], [3, 4]]) print(a_2d) # [[1 2] # [3 4]] # print(pd.Series(a_2d)) # ValueError: Data must be 1-dimensional, got ndarray of shape (2, 2) instead
🌐
PyTorch Forums
discuss.pytorch.org › t › typeerror-expected-np-ndarray-got-numpy-ndarray › 205227
TypeError: expected np.ndarray (got numpy.ndarray) - PyTorch Forums
June 24, 2024 - particle_type = self.particle_type[window["type"]: window["type"] + size].copy() particle_type = torch.from_numpy(np.asarray(particle_type)) In the following code snippet I am having following error Cell In[9], line 43, in OneStepDataset.get(self, idx) 41 size = window["size"] 42 particle_type = self.particle_type[window["type"]: window["type"] + size].copy() ---> 43 particle_type = torch.from_numpy(np.asarray(particle_type)) 44 position_seq = self.po...
🌐
GitHub
github.com › dask › dask › issues › 10467
How to upload dataframe with numpy array column using to_parquet in dask.dataframe? · Issue #10467 · dask/dask
August 28, 2023 - ## dask version == 2023.5.0 data = { 'float_array_column': [ np.array([1.1, 2.2, 3.3]), np.array([4.4, 5.5]), np.array([6.6, 7.7, 8.8, 9.9]) ] } path = {storage_path} storage_option = {storage_option} df = pd.DataFrame(data) df = dd.from_pandas(df, chunksize=5368709) dd.to_parquet(df, path, engine='pyarrow', storage_options=storage_option) ValueError: Failed to convert partition to expected pyarrow schema: `ArrowTypeError("Expected bytes, got a 'numpy.ndarray' object", 'Conversion failed for column float_array_column with type object')` Expected partition schema: float_array_column: string __null_dask_index__: int64 Received partition schema: float_array_column: list<item: double> child 0, item: double __null_dask_index__: int64 This error *may* be resolved by passing in schema information for the mismatched column(s) using the `schema` keyword in `to_parquet`.
Author   hjlee9182
🌐
GitHub
github.com › pytorch › pytorch › issues › 146987
torch.from_numpy() raises TypeError: “expected np.ndarray (got numpy.ndarray)” in PyTorch 2.6.0 · Issue #146987 · pytorch/pytorch
February 12, 2025 - 🐛 Describe the bug In PyTorch 2.6.0, the torch.from_numpy() function raises the following error when passing a NumPy array: TypeError: expected np.ndarray (got numpy.ndarray) To reproduce, run the following minimal example (which can be ...
Author   xiaoran007