murray3
United Kingdom
1 Posts |
Posted - 01/26/2024 : 04:25:38 AM
|
quote: Originally posted by syxz0628
Origin Ver. and Service Release (Select Help-->About Origin): Origin2022 Operating System:Windows I got this error message when I simply use the command: dfall = wksall.to_df()
AttributeError: 'DataFrame' object has no attribute
Looks like "iteritems" was removed in pandas 2.0.
Problem can be solved by installing pandas 1.5. However, I am wondering if there is other solutions in the future.
In this case, the 'iteritems' attribute is typically used to iterate over columns in a DataFrame. In pandas 2.0 and later versions, the preferred method for iterating over columns is to use the 'items()' method. Here's an example of how you can modify your code to work with the latest version of pandas:
dfall = wksall.to_df() for column_name, column_data in dfall.items(): # Do something with each column print(column_name, column_data) By using the 'items()' method, you can iterate over the columns of the DataFrame and access both the column names and the corresponding data. This approach will ensure compatibility with future versions of pandas. |
|
|