Home > Software design >  Date filter not applied on localhost (but via Jupyter)
Date filter not applied on localhost (but via Jupyter)

Time:10-08

Need to apply a date filter for my data frame (e.g. showing only data rows between 14/09/2014 and 30/08/2020).

So far, my code looks like this:

import dtale
import pandas as pd
df = pd.read_csv('https://manifestoproject.wzb.eu/down/data/2020b/datasets/MPDataset_MPDS2020b.csv', parse_dates=['date'], index_col='edate')
d = dtale.show(df)
df.loc['14/09/2014':'30/08/2020']
d.open_browser()

(As you can see, I'm working with d-tale as I'm completely new to coding, but need to analyze mass data for my research project.) The date filter is applied in VSC (I use Jupyter notebook so that I can check and run every step) correctly, it shows the results I need, but the filter is not applied on my localhost page as soon as I run d.open_browser(). Do you have any ideas what might be the reason?

Thanks for your help!

CodePudding user response:

Seems like you should show your data frame on dtale after filtering the data frame

df.loc['14/09/2014':'30/08/2020']
d = dtale.show(df) 
  • Related