Skip to content
New issue

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

future warnings to resolve #63

Open
npr99 opened this issue Jun 20, 2024 · 1 comment
Open

future warnings to resolve #63

npr99 opened this issue Jun 20, 2024 · 1 comment

Comments

@npr99
Copy link
Owner

npr99 commented Jun 20, 2024

Here's a summary of the issues along with their contexts:

Deprecated Downcasting on .fillna, .ffill, .bfill:

Files/Lines:
acg_01a_BaseInventory.py: lines 741, 803, 856
acg_02a_add_categorical_char.py: lines 470 (multiple)
Details: Using .fillna, .ffill, .bfill for downcasting object dtype arrays is deprecated. Suggested to use result.infer_objects(copy=False) or set the option pd.set_option('future.no_silent_downcasting', True).
Callable in GroupBy Sum:

Files/Lines:
acg_01a_BaseInventory.py: lines 1014 (multiple)
Details: The callable currently uses DataFrameGroupBy.sum. Future versions will use the callable directly. To retain current behavior, pass the string "sum" instead.
Setting Incompatible Dtype:

Files/Lines:
acg_02a_add_categorical_char.py: line 760 (multiple)
ncoda_00e_geoutilities.py: line 294 (multiple)
Details: Setting an item with an incompatible dtype is deprecated. For example, setting 0.5 in an int64 column or setting 2637860 and 'Hesperia' in a float64 column. Explicit casting to compatible dtypes is required.
Invalid Value Encountered in Computation:

Files/Lines:
expressions.py: line 73
Details: Runtime warnings due to invalid values encountered during less_equal and greater operations.
Deprecated DataFrame.applymap:

Files/Lines:
ncoda_07a_generate_hui.py: line 170
Details: DataFrame.applymap has been deprecated. Use DataFrame.map instead.
In summary, these issues are primarily related to deprecated pandas methods and operations, which need updating to avoid future compatibility problems.

@npr99
Copy link
Owner Author

npr99 commented Jun 20, 2024

Thank you chat gpt!
please summarise all of these issues: /workspaces/intersect-community-data/pyncoda/CommunitySourceData/api_census_gov/acg_01a_BaseInventory.py:741: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set pd.set_option('future.no_silent_downcasting', True)
expanded_hui_split['Not Set'][newchar_var[0]].fillna(value = 0)
/workspaces/intersect-community-data/pyncoda/CommunitySourceData/api_census_gov/acg_01a_BaseInventory.py:1014: FutureWarning: The provided callable <function sum at 0x722035f30ee0> is currently using DataFrameGroupBy.sum. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string "sum" instead.
total_sum_df = pd.pivot_table(df, values=values_to_sum, index=by_vars,
/workspaces/intersect-community-data/pyncoda/CommunitySourceData/api_census_gov/acg_01a_BaseInventory.py:803: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set pd.set_option('future.no_silent_downcasting', True)
updated_probability = expanded_hui_split['Not Set']['prob_'+newchar_var[0]].fillna(value = 1)
/workspaces/intersect-community-data/pyncoda/CommunitySourceData/api_census_gov/acg_01a_BaseInventory.py:856: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set pd.set_option('future.no_silent_downcasting', True)
expanded_hui_split['Not Set'][updated_countvar].fillna(value = 0)
/home/codespace/.local/lib/python3.10/site-packages/pandas/core/computation/expressions.py:73: RuntimeWarning: invalid value encountered in less_equal
return op(a, b)
/home/codespace/.local/lib/python3.10/site-packages/pandas/core/computation/expressions.py:73: RuntimeWarning: invalid value encountered in greater
return op(a, b)
/workspaces/intersect-community-data/pyncoda/CommunitySourceData/api_census_gov/acg_01a_BaseInventory.py:1014: FutureWarning: The provided callable <function sum at 0x722035f30ee0> is currently using DataFrameGroupBy.sum. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string "sum" instead.
total_sum_df = pd.pivot_table(df, values=values_to_sum, index=by_vars,
/workspaces/intersect-community-data/pyncoda/CommunitySourceData/api_census_gov/acg_01a_BaseInventory.py:1014: FutureWarning: The provided callable <function sum at 0x722035f30ee0> is currently using DataFrameGroupBy.sum. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string "sum" instead.
total_sum_df = pd.pivot_table(df, values=values_to_sum, index=by_vars,
/workspaces/intersect-community-data/pyncoda/CommunitySourceData/api_census_gov/acg_02a_add_categorical_char.py:470: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set pd.set_option('future.no_silent_downcasting', True)
merged_groups[self.new_char] = merged_groups[self.new_char].
/workspaces/intersect-community-data/pyncoda/CommunitySourceData/api_census_gov/acg_02a_add_categorical_char.py:760: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '0.5' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.
set_flag_df.loc[conditions, self.flaggeo_var] = .5
/workspaces/intersect-community-data/pyncoda/CommunitySourceData/api_census_gov/acg_02a_add_categorical_char.py:470: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set pd.set_option('future.no_silent_downcasting', True)
merged_groups[self.new_char] = merged_groups[self.new_char].
/workspaces/intersect-community-data/pyncoda/CommunitySourceData/api_census_gov/acg_02a_add_categorical_char.py:470: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set pd.set_option('future.no_silent_downcasting', True)
merged_groups[self.new_char] = merged_groups[self.new_char].
/workspaces/intersect-community-data/pyncoda/CommunitySourceData/api_census_gov/acg_02a_add_categorical_char.py:760: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '0.5' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.
set_flag_df.loc[conditions, self.flaggeo_var] = .5
/workspaces/intersect-community-data/pyncoda/ncoda_07a_generate_hui.py:170: FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.
hui_incore_df_fixed = hui_incore_df.applymap(lambda cell: int(cell) if str(cell).endswith('.0') else cell)
/workspaces/intersect-community-data/pyncoda/ncoda_00e_geoutilities.py:294: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '2637860' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.
copy_point_gdf.loc[precise_matches.index,geolevel+col] = polygon[col]
/workspaces/intersect-community-data/pyncoda/ncoda_00e_geoutilities.py:294: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value 'Hesperia' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.
copy_point_gdf.loc[precise_matches.index,geolevel+col] = polygon[col]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant