Skip to content

look up time values from a pandas.DataFrame #5887

Answered by max-sixty
raybellwaves asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @raybellwaves ! Hope all's well.

Is this because the df['lat'] is returning a series? Adding .values seems to return something — is that what you're hoping for?


In [6]: ds.sel(time=df["time"].values)
Out[6]:
<xarray.Dataset>
Dimensions:  (lat: 25, time: 2, lon: 53)
Coordinates:
  * lat      (lat) float32 75.0 72.5 70.0 67.5 65.0 ... 25.0 22.5 20.0 17.5 15.0
  * lon      (lon) float32 200.0 202.5 205.0 207.5 ... 322.5 325.0 327.5 330.0
  * time     (time) datetime64[ns] 2013-01-01 2013-01-01T06:00:00
Data variables:
    air      (time, lat, lon) float32 ...
Attributes:
    Conventions:  COARDS
    title:        4x daily NMC reanalysis (1948)
    description:  Data is from NMC initializ…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@raybellwaves
Comment options

Answer selected by raybellwaves
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants