diff --git a/py2vega/main.py b/py2vega/main.py
index f153309..9ccecf1 100644
--- a/py2vega/main.py
+++ b/py2vega/main.py
@@ -240,6 +240,30 @@ class VegaExpressionVisitor(ast.NodeVisitor):
 
         raise NameError('name \'{}\' is not defined, only a subset of Python is supported'.format(func_name))
 
+    def visit_Subscript(self, node):
+        """Turn a Python Subscript node into a Vega-expression."""
+        value = self.visit(node.value)
+
+        if isinstance(node.slice, ast.Index):
+            return '{value}[{index}]'.format(
+                value=value,
+                index=self.visit(node.slice.value)
+            )
+
+        if isinstance(node.slice, ast.Slice):
+            if node.slice.step is not None:
+                raise Py2VegaSyntaxError('Unsupported step for {} node, only a subset of Python is supported'.format(
+                    node.slice.__class__.__name__))
+
+            args = [value, '0' if node.slice.lower is None else self.visit(node.slice.lower)]
+            if node.slice.upper is not None:
+                args += self.visit(node.slice.upper)
+
+            return 'slice({args})'.format(args=', '.join(args))
+
+        raise Py2VegaSyntaxError('Unsupported {} node, only a subset of Python is supported'.format(
+            node.slice.__class__.__name__))
+
     def visit_Attribute(self, node):
         """Turn a Python attribute expression into a Vega-expression."""
         return node.attr

Support Python Slice node
We could map the `Slice` node to a Vega `slice` function call
diff --git a/test/test_py2vega.py b/test/test_py2vega.py
index 4fbbb57..cfaf5b0 100644
--- a/test/test_py2vega.py
+++ b/test/test_py2vega.py
@@ -122,6 +122,31 @@ def test_call():
     assert py2vega(code, whitelist) == 'length(value)'
 
 
+def test_subscript():
+    code = 'value[0]'
+    assert py2vega(code, whitelist) == 'value[0]'
+
+    code = '[34, 32][0 if value < 2 else 1]'
+    assert py2vega(code, whitelist) == '[34, 32][((value < 2) ? 0 : 1)]'
+
+    code = 'value[:2]'
+    assert py2vega(code, whitelist) == 'slice(value, 0, 2)'
+
+    code = 'value[1:]'
+    assert py2vega(code, whitelist) == 'slice(value, 1)'
+
+    code = 'value[:]'
+    assert py2vega(code, whitelist) == 'slice(value, 0)'
+
+    code = 'value[1:2]'
+    assert py2vega(code, whitelist) == 'slice(value, 1, 2)'
+
+    # Unsupported step parameter
+    code = 'value[::2]'
+    with pytest.raises(Py2VegaSyntaxError):
+        py2vega(code, whitelist)
+
+
 def foo(value):
     return 'red' if value < 150 else 'green'
 

pip install -e .[testing]
parse_log_pytest
pytest
pytest
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
flake8==5.0.4
importlib-metadata==4.2.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mccabe==0.7.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
-e git+https://github.com/QuantStack/py2vega.git@26e3208562b5851cf78ac2e8567d533a0c4698c8#egg=py2vega
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: py2vega
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - flake8==5.0.4
      - importlib-metadata==4.2.0
      - mccabe==0.7.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
prefix: /opt/conda/envs/py2vega

test/test_py2vega.py::test_subscript
test/test_py2vega.py::test_nameconstant test/test_py2vega.py::test_num test/test_py2vega.py::test_str test/test_py2vega.py::test_tuple test/test_py2vega.py::test_list test/test_py2vega.py::test_dict test/test_py2vega.py::test_unary test/test_py2vega.py::test_binary test/test_py2vega.py::test_ternary test/test_py2vega.py::test_compare test/test_py2vega.py::test_call test/test_py2vega.py::test_function test/test_py2vega.py::test_whitelist test/test_py2vega.py::test_math test/test_py2vega.py::test_invalid1 test/test_py2vega.py::test_invalid2 test/test_py2vega.py::test_invalid3 test/test_py2vega.py::test_invalid4 test/test_py2vega.py::test_lambda test/test_py2vega.py::test_if_stmt test/test_py2vega.py::test_assign1 test/test_py2vega.py::test_assign2 test/test_py2vega.py::test_assign3 test/test_py2vega.py::test_assign4 test/test_py2vega.py::test_assign5 test/test_py2vega.py::test_assign6 test/test_py2vega.py::test_assign7 test/test_py2vega.py::test_assign8 test/test_py2vega.py::test_assign9
py2vega/main.py
py2vega/main.py