We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failing to convert to integer on writing out
Steps to reproduce the behavior:
2022-02-25 11:24:58, INFO: Converting variable type to MetCouncil standard --------------------------------------------------------------------------- ValueError Traceback (most recent call last) c:\lasso\lasso\roadway.py in convert_int(self, int_col_names) 1116 self.links_df[c] = self.links_df[c].replace(np.nan, 0) -> 1117 self.links_df[c] = self.links_df[c].astype(int) 1118 except: c:\programdata\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\generic.py in astype(self, dtype, copy, errors) 5697 # else, only a single dtype is given -> 5698 new_data = self._data.astype(dtype=dtype, copy=copy, errors=errors) 5699 return self._constructor(new_data).__finalize__(self) c:\programdata\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\internals\managers.py in astype(self, dtype, copy, errors) 581 def astype(self, dtype, copy: bool = False, errors: str = "raise"): --> 582 return self.apply("astype", dtype=dtype, copy=copy, errors=errors) 583 c:\programdata\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\internals\managers.py in apply(self, f, filter, **kwargs) 441 else: --> 442 applied = getattr(b, f)(**kwargs) 443 result_blocks = _extend_blocks(applied, result_blocks) c:\programdata\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\internals\blocks.py in astype(self, dtype, copy, errors) 624 try: --> 625 values = astype_nansafe(vals1d, dtype, copy=True) 626 except (ValueError, TypeError): c:\programdata\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\dtypes\cast.py in astype_nansafe(arr, dtype, copy, skipna) 873 if np.issubdtype(dtype.type, np.integer): --> 874 return lib.astype_intsafe(arr.ravel(), dtype).reshape(arr.shape) 875 pandas\_libs\lib.pyx in pandas._libs.lib.astype_intsafe() ValueError: invalid literal for int() with base 10: '' During handling of the above exception, another exception occurred: ValueError Traceback (most recent call last) <ipython-input-81-0e2b6783f220> in <module> ----> 1 m_net.roadway_standard_to_met_council_network() c:\lasso\lasso\roadway.py in roadway_standard_to_met_council_network(self, output_epsg) 1190 WranglerLogger.info("Splitting variables by time period and category") 1191 self.split_properties_by_time_period_and_category() -> 1192 self.convert_int() 1193 1194 self.links_metcouncil_df = self.links_df.copy() c:\lasso\lasso\roadway.py in convert_int(self, int_col_names) 1117 self.links_df[c] = self.links_df[c].astype(int) 1118 except: -> 1119 self.links_df[c] = self.links_df[c].astype(float) 1120 self.links_df[c] = self.links_df[c].astype(int) 1121 c:\programdata\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\generic.py in astype(self, dtype, copy, errors) 5696 else: 5697 # else, only a single dtype is given -> 5698 new_data = self._data.astype(dtype=dtype, copy=copy, errors=errors) 5699 return self._constructor(new_data).__finalize__(self) 5700 c:\programdata\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\internals\managers.py in astype(self, dtype, copy, errors) 580 581 def astype(self, dtype, copy: bool = False, errors: str = "raise"): --> 582 return self.apply("astype", dtype=dtype, copy=copy, errors=errors) 583 584 def convert(self, **kwargs): c:\programdata\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\internals\managers.py in apply(self, f, filter, **kwargs) 440 applied = b.apply(f, **kwargs) 441 else: --> 442 applied = getattr(b, f)(**kwargs) 443 result_blocks = _extend_blocks(applied, result_blocks) 444 c:\programdata\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\internals\blocks.py in astype(self, dtype, copy, errors) 623 vals1d = values.ravel() 624 try: --> 625 values = astype_nansafe(vals1d, dtype, copy=True) 626 except (ValueError, TypeError): 627 # e.g. astype_nansafe can fail on object-dtype of strings c:\programdata\anaconda3\envs\lasso_env\lib\site-packages\pandas\core\dtypes\cast.py in astype_nansafe
Operating system: Context (conda, jupyter, etc): Environment (e.g. output from conda list):
conda list
The text was updated successfully, but these errors were encountered:
@RachelWikenMC @DavidOry did this PR fix this issue for you?
Sorry, something went wrong.
e-lo
No branches or pull requests
Describe the bug
Failing to convert to integer on writing out
To Reproduce
Steps to reproduce the behavior:
Failing tests
Triggering line of code
Thoughts on resolution
Full stack trace
Environment
Operating system:
Context (conda, jupyter, etc):
Environment (e.g. output from
conda list
):The text was updated successfully, but these errors were encountered: