Skip to content

How to avoid duplicated data due to bnds when converting nc to a dataframe? #117

Answered by robertjwilson
JairoVS asked this question in Q&A
Discussion options

You must be logged in to vote

You will need to remove these manually using pandas. So something like:

df = ds.to_dataframe().reset_index()
df = df.drop(columns = "bnds").drop_duplicates()

I don't have the data, so I'm not sure what the bnds refer to. But for ocean data, this is often the maximum and minimum depth for a particular cell. It is is data associated with coordinates, not a data varaible. This kind of information is sometimes useful, so nctoolkit keeps it in the output from to_dataframe. An example is when you can calculate the cell height from the bnds, and need that later on. Though, if you are getting 0s and 1s then there is probably not meaningful information in it.

However, to_dataframe probably should…

Replies: 2 comments 2 replies

Comment options

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

Answer selected by JairoVS
Comment options

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

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