Benas Pekarskis
Benas Pekarskis

Reputation: 13

How to use the information that is entered in Jupyter Widgets-Date picker?

Im looking how can I use the information (in this case date) that is entered in Jupyter Widgets-Date picker. My code below creates a widget where I can select the date.

import ipywidgets as widgets
w=widgets.DatePicker(
    description='Pick a Date',
    disabled=False
)
w

enter image description here

How can I use the date that is selected in the widget?

Upvotes: 0

Views: 4566

Answers (2)

albertovpd
albertovpd

Reputation: 137

For pyspark it could be something like

import ipywidgets as widgets
w = widgets.DatePicker(
    description='Pick a Date',
    disabled=False
)
w

Then you access it like:

w.value
table = spark.read.parquet("path")
table.filter(F.col(your_date_column)==w.value).show()

Check the image below for how the output looks like:

Filter with Pyspark

Upvotes: 2

ac24
ac24

Reputation: 5565

As with all widgets, you can access the chosen value using w.value.

The ipywidgets tutorial can take you through some basic concepts: https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Basics.html

Upvotes: 0

Related Questions