Questions tagged [nan]

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

NaN (Not a Number) is a value of the numeric data type representing an undefined or unrepresentable value, especially in floating-point calculations. Systematic use of NaNs was introduced by the IEEE 754 floating-point standard in 1985, along with the representation of other non-finite quantities such as infinity.

A common feature of NaN in many programming languages is that NaN is not equal to itself.

4290 questions
1
vote
1 answer

using isnan in julia doesn't catch all the NaNs

NaNs keep getting introduced into my results for some reason, despite using isnan to filter them. This code generates NaNs in the X variable sometimes but not always, and I'm confused as to how it's not getting filtered out. See the comments # in…
1
vote
1 answer

Pandas - Passing working values from read_csv to a DataFrame turns everything to NaN, why?

I'm working on a script which reads a bunch of txt files into pandas for data processing. A sample of a text file would…
Andreas
  • 13
  • 2
1
vote
2 answers

Replace NaN values of DataFrame with values from list

I have a DataFrame with 14 variables which has several NaNs. I would like to fill these NaNs with a specific value existing in a list. This is the df: Date CalamarQ InkorQ ... SHelena2P GamboteP DiqueP 243 1990-09-01 6033.0 …
Amy Zammit
  • 11
  • 2
1
vote
1 answer

Query target NaN bit pattern that would be syntheiszed by 0.0 / 0.0 when cross compiling

I have a C++ cross-compiler. It produces some floating point code that, at runtime, may generate NaN. On my host platform I want to prepare target-aware "gold" testing results. These will be compared against printf output generated on the target…
John Yates
  • 1,027
  • 1
  • 7
  • 18
1
vote
2 answers

How to pad/ffill NaN values in a Pandas dataframe using "inside" as limit_area?

I have a Pandas dataframe containing several NaNs like the following one df = pd.DataFrame(np.array([[1,np.nan,np.nan, 2, 3, np.nan], [np.nan,np.nan,0,0,np.nan,2], [np.nan,4,np.nan,np.nan,5,np.nan]]).transpose()) print(df) 0 1 2 0 …
pa1ric6
  • 39
  • 6
1
vote
0 answers

Correlation coefficients at each grid point in python

I am trying to calculate correlation coefficients at each grid point in python. The dimension of two variables(variable1[t,y,x], variable2[t,y,x]) are same and I would like to get a correlation coeffients as [y,x]. Two variables have irregular…
1
vote
1 answer

Transfer the specific values from one pd dataframe to another

Can you please help me? I have two pandas dataframes and I need to extract every tenth value from the specific column from the first dataframe in a list. Then I need to create a new column in a second dataframe and put these values in this column. I…
1
vote
1 answer

How can gnuplot check for valid values within a plot loop?

I want to calculate histograms from a file "a_test.dat" like this: # block_1 x y 1 1979.2 1 1598.6 1 1430.8 1 1544.7 1 1953.3 1 1288.8 1 1741.3 1 1791.1 # block_2 x y 2 2027 2 1591.4 2 1401.6 2 1923.7 2 1677 2 1311.1 2 1689.3 2 2015.8 So I define…
magfan
  • 181
  • 1
  • 9
1
vote
1 answer

all points y value undefined and the syntax of "using" modifier

I came across an unexpected Gnuplot behaviour (Version 5.2 patchlevel 6) I could not explain, so far. This is the data (though any similar data would do): x y 0 1.1 1 1.0 2 1.3 3 1.4 4 0.9 The line p a=0 'data.txt' u 1:(a=a+$2,a) w…
Galileu
  • 63
  • 1
  • 5
1
vote
0 answers

Is there a way to display the yaxis label in a Plotly/Dash heatmap row with NaNs only (empty heatmap trace)?

I would like to show different heatmaps in different figure traces (Each heatmap with it's own colorscale, range etc.) Therefore, I fill figure traces with individual heatmaps (go.Heatmap): import numpy as np import plotly.graph_objects as go from…
avm
  • 21
  • 2
1
vote
1 answer

How to change values in specific rows/columns to NaN based on condition?

I’ve got some strange values in my date column of my dataset. I’m trying to change these unexpected values into NaN. I don’t know what these unexpected values will be, hence why I made df 2 - where I’m searching for months (e.g. Dec, March) and then…
wick
  • 61
  • 4
1
vote
0 answers

The val_loss is nan, but loss is printing. Both train and validation losses are nan in model.evaluate(), and the acc improves during training

There is a 2-class classification problem, and my loss function is custom. The labels are categorical, and the final activation function is Softmax. During the training, the loss is printed, but the val_loss is nan(inf). Using…
1
vote
1 answer

why i am facing with problem when i try to change columns to 0 an 1?

data.head() experience stay No relevent experience 0 Has relevent experience 1 No relevent experience 0 Has relevent experience 1 No relevent experience 0 data['experience'] = data['experience'].map({'Has relevent…
1
vote
1 answer

Plotly px.Scatter or go.Scatter Graph Unique Color/Symbol for specific points (Simple Map)

I am attempting to create a simple site map using Plotly. I can't use scatter_geo because I am using known X, Y coordinates relative the site - not lat/long. px.Scatter or go.Scatter seem to be a viable option for a mostly simple map. So, I have a…
Sam Dean
  • 379
  • 9
  • 19
1
vote
1 answer

Get row, column pairs that are not nan from a DataFrame

I have a DataFrame which contains a lot of NAN values, and it has around 100 columns and 100 rows which makes it difficult to have an overview of the rows, column pairs that are not NAN. What is the best way to get a list of the rows, column pairs…
Pythoneer
  • 143
  • 8
1 2 3
99
100