A value too large for dtype('float64') error

How  to remove his error for  stock market data.  i  tried scaling  data but  not  workin.  i  am  applying HRP andtrying  to  create dendograms. but  i am getting  the above error as the  stockpricehaving too  large  value. how  to  fix this





I checked infinity values NaN  values. issue  is with  too  larege value  for  Float64 Dtype

Hi Keerthi,



Since you've already tried scaling the data and have checked for NaN values, you can try the following:

1. If you are using the older versions of libraries, the simple solution to this cause would be to update all the libraries you are using. Learn more here.



2. You can truncate the float values to a certain number of decimal places. Learn how to do it here.



3. You can also limit the decimal places by using the round method. This piece shows a quick example of it.



Before you do any of this, make sure that you are scaling the data correctly and within the appropriate range. For example, you can use techniques such as normalization or standardization to scale the data to a smaller range that can be represented by 'float64' data type.



You should also check for any missing or NaN values in your data, as they can also cause issues with data type casting. Make sure to handle them appropriately, such as by filling them with valid values or removing them from the data set.



After trying all of the above approaches and if you are still encountering the error, it may be helpful to provide more specific details about the error, your code and your data.



Hope you find this helpful!



Thanks,

Rushda Ansari

I  did all possibilities still not  resolved. everytime new error. i  filled Nan dat  with fillna(0), i removed Infite values .



in  HRP  project , while Data Preperation we  need  final  stock list and financial ratio as  input,  i  fetched. after  that calulated  mothly return. and joine thetable with  finacial ratio such as ROE and NPM. 



and then splitted data as training  and testing data. till hereworking  fine.



issue strats  when we scale training  dataset with  train_data as input.

how  to truncate all columns whse values are stored in scaled_training  _dataset

 

Hi Keerti,



The error you are facing is unclear. Sounds like you are facing issues while scaling the data. You can check the data type and ensure that all columns in your dataset are of numeric data type (float/int).



If the issue persists, please share the exact error that you are facing as well as the libraries that you are using.



Thanks,

Rushda