0

I am quite new with NetCDF files. I am trying to analyze a dataset that contains global information of land use from 1899 to 2019. I would like to select a year and convert the information into a dataframe.

This is what I am doing

import xarray as xr  
dnc = xr.open_dataset(fn)
dnc

enter image description here

How can I get the data fro the year 1965 and convert to a dataframe?

emax
  • 6,965
  • 19
  • 74
  • 141

1 Answers1

1

Converting an xarray dataset to dataframe is fairly straightforward, as there is a built-in method:

df = ds.to_dataframe()
Robert Wilson
  • 3,192
  • 11
  • 19