Questions tagged [nan]

NaN is an abbreviation for "Not a Number". NaN is sometimes not equal to itself.

Filter by
Sorted by
Tagged with
-8 votes
1 answer
71 views

Why does my recursion double- function return -nan(ind) instead of x?

I'm a begginer in C++ programming. I didn't find division by zero and a negative number in sqrt. Why does approx_root() return -nan(ind) instead of x? Help me pls! #include <iostream> #include &...
snowflake's user avatar
0 votes
2 answers
45 views

Removing NaNs in a JSON file using python

Json file example: { "name": "John Doe", "age": 30, "height": null, "weight": NaN, } { "name": "Jim Hanks", "age&...
lhamo's user avatar
  • 3
-2 votes
0 answers
25 views

Why nan values in Statsmodel regression sheet? [closed]

Cannot figure out. Please help. There are 9 variables with nans across the table. What could be the problem? All the columns are one hot encoded but there are other such columns that dont face such an ...
satyamchadha's user avatar
0 votes
0 answers
15 views

FlutterFlow ' Nan ' with code expression. how can i solve it?

[preview][code expression] After setting two variables in the app state, when I fetch and calculate these two variables in the code expression, NaN is output as shown in the picture. After testing ...
Bie ao's user avatar
  • 1
0 votes
0 answers
17 views

Datacleaning - Using Negative Mean to fill NaN?

what is the consensus on if you have a dataset that only deals with positive numbers, say you have data of phone models, screen size, color, ram, price etc.. say the same phone models can also have ...
Eeeks's user avatar
  • 1
-1 votes
0 answers
24 views

JS calculator script works everywhere but not on iphone, NAN error

I created Html + JS calculator that works fine except iphone, on iphone result is NAN. i Can`t find solution, something in script calculation algoritm. I cut off html and JS of calculator and inserted ...
FreddyJones's user avatar
0 votes
1 answer
37 views

I am facing he NaN error on WordPress Custom HTML

I am having an issue with my code when I execute the code in code editor it working good but when is execute the code in WordPress the code is not working well its giving the NaN error. code is ...
Umer Rashid's user avatar
0 votes
0 answers
27 views

Trying to write yolo1 with pytorch, but get NaN when train

Please, I want to know if my model or lossfunction or dataset is wrong. I have tried printing many things for debugging, but I still don't know where the problem is. My source code is: import time ...
Xing's user avatar
  • 1
0 votes
1 answer
26 views

Empty columns using pd.merge

see I'm doing a simple merge between two data frames, the one I'm working with is called BD, and has about 50 columns, the other data frame is called PROD and has only three columns productID, ...
JoseM's user avatar
  • 1
1 vote
1 answer
35 views

Training LSTM neural network with missing values in target data - error optim.step()

I am would like to train the LSTM neural network with missing values in the target data and user-defined loss function. However, there is an error after optim.step(), some weights/biases are nan. Is ...
tamnva's user avatar
  • 45
0 votes
1 answer
20 views

Why does get_as_dataframe work differently when worksheets change?

Beginner in Python. After reading a specific worksheet in a spreadsheet, I usually check if the data is imported correctly by printing the dataframe. However, there are some worksheets that output ...
Kento's user avatar
  • 1
0 votes
0 answers
37 views

What type of "NaN" does this Python Pandas dataframe column have? [duplicate]

So, I have a Pandas dataframe, and wish to iterate upon a column, doing stuff on the NaNs. Issue is: no direct comparison wants to give me a True. Checking the column via isna() and notnull() works ...
Makel's user avatar
  • 23
0 votes
1 answer
33 views

Intermittent NaN and INF Values on ESP32

I am developing some PID code for an ESP32 dev module. Most times that I execute the code, the integral value is NaN or INF. However, upon unplugging and replugging in the USB connection, occasionally ...
Mitchell Conrad's user avatar
0 votes
2 answers
58 views

"nan" instead of matrix elemets in output in Python?

I am trying to calculate an approximate solution for this sparse matrix problem Au=f, but I am getting "nan" in the output of my matrix instead of matrix elements, although the input ...
Anushka Tilekar's user avatar
0 votes
2 answers
88 views

Why is np.where transforming some of my data into NaN values?

I wanted to split data values if \n was present in a column. This is a snippet of my original data column (note I casted this column to a object datatype): 0 881567905 1 ...
Jeff Gordon's user avatar
0 votes
1 answer
29 views

Compare two dataframes and handle comparison with NaN

Imagine, you have two dataframes. Both have a column "name" with exact the same values (here: A,B,C,D). Now, the "values" shall be checked between the corresponding names. import ...
teq508's user avatar
  • 51
1 vote
1 answer
24 views

Calculate RMSE in two matrix when they include Nan value in Python Code

I am a beginner at using Python code, and I have a problem with calculating the RMSE in two matrixes when they include Nan values. For example, I have two matrixes, which include a couple of columns ...
pay mia's user avatar
  • 21
1 vote
1 answer
32 views

numpy.nan_to_num equivalent in sql?

I am trying to rewrite a set of python operations in SQL. Specifically, I have a python script that queries from a sqlite3 connection from a table table_name for the column vals and note that vals is ...
24n8's user avatar
  • 1,986
0 votes
0 answers
6 views

Label from Price at Timestamp Returns Nan

From an interactively selected date, I am able to plot a horizonal line. The status line displays the y-coordinate value. I wish to add a label at the end of the horizontal line. The code I am using ...
TRandom's user avatar
-1 votes
2 answers
71 views

WPF DataGrid How to Display Blank for Double.Nan?

I have a large amount of data that are carried by a DataTable. Most of the data are doubles; however, many of them are NaN as shown below: I'd like to change the display of those NaN values to, say ...
T. J. Fan's user avatar
0 votes
3 answers
99 views

Validate against NaN values for <input type="number">

I am creating a form using Angular Reactive forms, and for UX reasons I am trying to disable the form's submit when certain invalid values are inserted in an <input type="number"> ...
FaBEEola's user avatar
0 votes
1 answer
27 views

Visual Studio Code Debugger shows 0 for a double that is NaN

While searching for why the double averagePrice in my program was NaN I stumbled upon this weird behaviour for the Visual Studio Code Debugger. The Debugger shows averagePrice = 0 whereas double.IsNaN ...
Sascha's user avatar
  • 1
0 votes
1 answer
17 views

Why does a series or dataframe column of integers containing NaN values have "float64" as data type?

Either by using pd.read_csv or by defining a series of integers, if it contains a NaN value, then the data type of that series or column becomes "float64", including the respective ".0&...
Gin Al's user avatar
  • 1
0 votes
0 answers
15 views

Nan values returned for y_pred when run on gpu

I have a model which i have tried training on the gpu on my laptop and cpu on a seperate computer. On both, it runs fine and returns values for the loss. When i run it on a gpu on the computer (where ...
Eeerog's user avatar
  • 1
0 votes
0 answers
26 views

How can I replace NaN values with empty cells in Pandas in Python? [duplicate]

I have a large Pandas dataset in Python with several columns of different data types that all contain some cells that are NaN. My problem is that I want these cells to be empty rather than say 'nan', ...
Marcus K.'s user avatar
  • 311
1 vote
0 answers
55 views

Inconsistent behavior of Sklearn's precision_score when manual cross-validation is performed vs. cross_val_score

I'm trying to use precision_score with np.nan for the zero_division. It's not working with cross_val_score but working when I do manual cross-validation with the same pairs. Here's the data files to ...
O.rka's user avatar
  • 30.3k
0 votes
1 answer
47 views

Custom Trimmed Mean function returning 'NaN' in R

I am trying to build a trimmed mean function, but the function is returning 'NaN' I am not sure where in the function the issue resides trimmed_mean <- function(x, trim) { n = length(x) ## ...
gcollier_96's user avatar
1 vote
1 answer
30 views

dropna is filling all the column with None rather than just the NaN values

Working with a DataFrame about places to start and places to go, kind of a Uber app. It is given to me a DataFrame with 2 columns that have lots of NaN values: Some of them are NaN and other are ...
Manuel Veiga's user avatar
1 vote
2 answers
187 views

How to plot NaN values as gaps in a scatter plot

I have a figure with six subplot control charts from a Pandas dataframe, currently plotted by index and I'd like to plot them against a datetime value. The raw data (from an XML file) contains blank ...
ChemEnger's user avatar
  • 149
1 vote
1 answer
40 views

Rename index if nan

I have a df with index "Take_Make". Inside this index is one value with NaN. How can I rename this NaN to another "real" value, like "CatX" ? df and df.index are shown ...
teq508's user avatar
  • 51
0 votes
0 answers
9 views

Solving natural convection equation with SIMPLE algorithm

In the attached code, I am trying to simulate natural convection using the SIMPLE algorithm, with convergence methods like Upwind, etc. I have two problems: The code doesn't generate meaningful plots ...
Steren's user avatar
  • 127
0 votes
0 answers
48 views

pandas is (mis)reading "1" as NaN in csv file

I am using pandas to read a csv file, but bizarrely it's not recognising number "1". Instead, it displays them as NaNs. Any ideas on why and how to fix them? When I open the csv file in ...
tres's user avatar
  • 1
0 votes
0 answers
72 views

Grafana - Alert does not trigger due to "nodata" / "NaN"

Working on a Azure Managed Grafana setup with Azure Monitor as Data Source. After adding an alert to a panel, the alert doesn´t trigger, and the panel looks like this: The alert goes into a pending ...
objectclass's user avatar
0 votes
2 answers
59 views

Pandas filling NaN values with a string value and keeping None values as the same [duplicate]

I have a dataframe with mixed datatypes. I would like to fill NaN values but keep None values as the same. I tried to use fillna() method from pandas but the function is filling both NaN and None ...
Cansu Zöhre's user avatar
0 votes
0 answers
14 views

Error in base::":"(from, to) : NA/NaN argument

Trying to run ordinal logistic regression, and running into NA/ NaN argument. There are no NAs in the base data code: call: polr( as.factor(reporting_score) ~ Plan.Pkg.hr, data = dat, Hess = TRUE) ...
Saumya Khaitan's user avatar
1 vote
1 answer
39 views

To detect null cells in a column which includes list and Nan

I have a dataframe, which has a column includes list and Nan. I want to replace all the empty list and Nan with {}. My data is: df['c'] = [[l1],[l2]], [], Nan I have tried using - df['c'].apply(...
lili's user avatar
  • 13
-1 votes
1 answer
23 views

Python: how to replace str in df to np.nan?

I have a dataframe X. X contains strs and numeric values. I need to replace all the strs in the whole dataframe into np.nan. I tried several methods: enter image description here but there is ...
rain's user avatar
  • 1
1 vote
0 answers
49 views

mask a xarray.dataset using nan values in another dataset

I have a dataset (named ds1) that includes HWI (heatwave index) data variable with dimensions of time: 365, latitude: 681, longitude: 841 I want to mask ds1 by using ds2 which has the same dimensions ...
Navid Ghajarnia's user avatar
0 votes
0 answers
24 views

plt.savefig behaviour in eps mode for nan type using imshow [duplicate]

I am trying to save an image using plt.imshow and plt.savefig by inputting a certain 2D array that happens to contain NaNs. When I call plt.show() the NaNs map to white but when saved to an eps file ...
maxxpinse's user avatar
0 votes
1 answer
38 views

Why element wise division between two dataframes with one column each result in NaN and two columns?

import pandas as pd df0 = pd.DataFrame({'a': [864371.0, 864383.0, 864364.0, 864381.0, 864364.0]}) df1 = pd.DataFrame({'b': [867318.0, 867315.0, 867323.0, 867331.0, 867327.0]}) df0/df1 a b 0 ...
jjw's user avatar
  • 11
-2 votes
2 answers
35 views

Unable to replace the nan values using the fillna function

I have a pandas dataframe. I am trying to replace the nan values of one of the columns with last valid observation using the ffill method of fillna function. But that just dosen't seem to work. I have ...
Nilkanth Wable's user avatar
0 votes
0 answers
19 views

Identifying and resolving the source of NaN's when calculating k-means centroids for image compression in Python

I am working on an assignment where we are supposed to manually create a k-means clustering algorithm and use it for image compression in python. My code is below. When I run the algorithm for one ...
DiYage's user avatar
  • 33
0 votes
1 answer
81 views

Dealing with NAN Values in Xarray when using .sum() for a basin NetCDF file

The following code takes a global precipitation NetCDF file with daily data and a basin shape file as input data. The precipitation data is clipped as it would be done in ArcGIS or QGIS using the ...
jei L's user avatar
  • 33
-2 votes
1 answer
73 views

Getting loss nan with GPU after half an epoch but never with CPU

When training with GPU i see fairly large fluctuations in loss and val-loss and quite fast i get loss NaN. If i reduce the learning rate by a lot I'm able to sometimes keep it from going loss NaN. But ...
Christian Reinholdt Andersen's user avatar
0 votes
0 answers
25 views

Data Frame problem with filling Nan values

I'm looking To fill Nan population values for specific states/values for column State in my date Frame using jupiter notebooks. Code: DataGroupby = pd.DataFrame(Data.groupby(['State'])['Population']....
Flyguy's user avatar
  • 1
0 votes
0 answers
22 views

overflow error encountered when running gradient descent

I am constantly encountering these kind of overflow errors in my python code for Gradient Descent Algorithm. e.g. RuntimeWarning: overflow encountered in scalar add RuntimeWarning: overflow ...
Sagnik's user avatar
  • 1
0 votes
2 answers
42 views

How do I replace NaN with 0 or "No Input Found"

I am trying to replace the result of NaN in my calculator result with 0 or the words "No Input Found". Here is the Javascript Code for the Section. // Calculator Functions JavaScript STARTS ...
Jordan's user avatar
  • 13
1 vote
0 answers
72 views

Numpy complex128 nan in division

I am trying to understand why I get a warning using numpy's (version 1.24.2) complex128, which I do not get using the built-in complex type: import math, numpy (math.nan)/(1j*math.nan) # (nan+nanj) (...
Lukas Lang's user avatar
0 votes
0 answers
23 views

Pandas, correlation between two dataframes with columns having the same name, resulting in NaN

I have two databases with the same column names and numbers. The data contains cells without data (NaN). When trying to generate the correlation with corrwith(), I only get NaN. If I correlate the ...
c_gerard's user avatar
1 vote
0 answers
40 views

How do I replace NaN-values in my dataset with imputed KNN-values? A part of the values remains as NaN-value

I am working on a water quality dataset. The dataset has the following numerical columns: Water Temperature, Turbidity, Wave Height, Wave Period, Battery Life, Transducer known Before imputing, Water ...
mrgoat's user avatar
  • 19

1
2 3 4 5
87