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

[ENHANCEMENT] improve validate_series checks and messages #577

Closed
dbrakenhoff opened this issue Mar 22, 2023 · 1 comment · Fixed by #578
Closed

[ENHANCEMENT] improve validate_series checks and messages #577

dbrakenhoff opened this issue Mar 22, 2023 · 1 comment · Fixed by #578
Assignees
Labels
enhancement Indicates improvement of existing features priority 1 normal, deal with in the foreseeable future

Comments

@dbrakenhoff
Copy link
Member

Describe the proposed enhancement

In a course a lot of users ran into their time series not being ready for pastas, I (and @martinvonk) think adding these checks would further help users along.

  • Add an error and message specifically for multi-column DataFrames:
# specific msg for multi-column DataFrame.
msg = "DataFrame with multiple columns. Please select one."
raise ValueError(msg)
  • Add a check for NaT types in series.index
# check if index contains NaNs
if s.index.hasnans:
    logger.info("The time series index contains NaNs. Try to remove these with `series.loc[series.index.dropna()]`.")
@dbrakenhoff dbrakenhoff added the enhancement Indicates improvement of existing features label Mar 22, 2023
@martinvonk
Copy link
Collaborator

Goes wrong with this kind of csv:

date,level
2016-01-21 13:00,9.55
2016-01-21 14:00,9.55
2016-01-21 15:00,9.55
,
,

series = pandas.read_csv(csv, index_col=0, parse_dates=True)
pastas.validate_stress(series) raises:
ValueError: The time-indices of series level are not monotonically increasing. Try to use series.sort_index() to fix it.

dbrakenhoff added a commit that referenced this issue Mar 22, 2023
- add multi-column dataframe error+message
- add series.index NaT error and solution in msg
@dbrakenhoff dbrakenhoff linked a pull request Mar 22, 2023 that will close this issue
5 tasks
@martinvonk martinvonk added the priority 1 normal, deal with in the foreseeable future label May 10, 2023
dbrakenhoff added a commit that referenced this issue May 11, 2023
Co-authored-by: Martin Vonk <vonk.mart@gmail.com>
Co-authored-by: Martin Vonk <66305055+martinvonk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates improvement of existing features priority 1 normal, deal with in the foreseeable future
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants