-4

When I try to convert the pandas DataFrame to Xarray dataset I get this error:

ValueError: can only convert an array of size 1 to a Python scalar

Image:

enter image description here

Code:

# Convert the DataFrame back to xarray Dataset and assign CRS
temp_group_df.set_index(['lat', 'lon', 'month'], inplace=True)
temp_array = temp_group_df.to_xarray()
temp_array.rio.write_crs('epsg:4326', inplace=True)
display(temp_array)

halfer
  • 19,824
  • 17
  • 99
  • 186
sharaf
  • 3
  • 1

1 Answers1

0

You can not convert lists or tuples in your cells to xarray. So you can't convert your columns burned_area and result.

Convert those columns to multiple columns with single values and the conversion should work.

JonasV
  • 792
  • 5
  • 16