Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.plot() no longer works on the dataframes. #18

Closed
mroberge opened this issue Mar 8, 2018 · 2 comments
Closed

.plot() no longer works on the dataframes. #18

mroberge opened this issue Mar 8, 2018 · 2 comments

Comments

@mroberge
Copy link
Owner

mroberge commented Mar 8, 2018

  • HydroFunctions version: 0.1.6

Description

The new dataframe format has the data qualifiers adjacent to the data, so that different columns have different types of data placed together. Now when you try to plot using: my_dataframe.plot() it generates an error.

What I Did

import hydrofunctions as hf
%matplotlib inline
sites = ['01581830', '01589330']
data = hf.NWIS(sites, start_date='2002-01-01', end_date='2005-01-01').get_data()
data.ok

data.df().plot()
-error-

Pandas has no way of converting what is in the column into something it can plot.

Proposed Solution:

Create different functions for creating different kinds of dataframe layout. There is more than one way to organize the data into a dataframe. Create a method for outputting a dataframe that can be plotted automatically.

Perhaps put the qualifiers into an identical dataframe that matches cell for cell with the data.

@mroberge
Copy link
Owner Author

see issue #26.

@mroberge
Copy link
Owner Author

Closed with the feature-df-select branch. See commit e3e4d42. Now you can just request the data you want to plot, and it plots fine.

herring = hf.NWIS('01585219', 'iv', period='P5D')
herring.df('discharge').plot()

This should work fine. Although it gives a warning about stripping off the UTC time zone info.

Improve the NWIS interface for hydrofunctions automation moved this from To do to Done Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant