File: construct_dataframe.rst

package info (click to toggle)
pandas 2.2.3%2Bdfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 66,784 kB
  • sloc: python: 422,228; ansic: 9,190; sh: 270; xml: 102; makefile: 83
file content (9 lines) | stat: -rw-r--r-- 309 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
A pandas ``DataFrame`` can be constructed in many different ways,
but for a small number of values, it is often convenient to specify it as
a Python dictionary, where the keys are the column names
and the values are the data.

.. ipython:: python

   df = pd.DataFrame({"x": [1, 3, 5], "y": [2, 4, 6]})
   df