From 739e230a17e570f329df3dacf633274fa6adee81 Mon Sep 17 00:00:00 2001 From: Philippe THOMY Date: Tue, 21 May 2024 14:45:16 +0200 Subject: [PATCH] add pre-commit --- example/example_multidimensional.ipynb | 38 +++++++++++++------------- ntv_pandas/__init__.py | 17 +++++++++--- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/example/example_multidimensional.ipynb b/example/example_multidimensional.ipynb index 3266b16..e2a8935 100644 --- a/example/example_multidimensional.ipynb +++ b/example/example_multidimensional.ipynb @@ -693,28 +693,28 @@ " id (plants, quantity, price level) int64 64B 1003 1001 ... 1006\n", " location (plants, quantity, price level) <U2 64B 'es' 'fr' ... 'ch' 'fr'\n", " price (plants, quantity, price level) float64 64B 2.0 1.0 ... 15.0\n", - " supplier (plants, quantity, price level) <U4 128B 'sup1' ... 'sup2'
    • plants
      PandasIndex
      PandasIndex(Index(['fruit', 'vegetable'], dtype='object', name='plants'))
    • price level
      PandasIndex
      PandasIndex(Index(['high', 'low'], dtype='object', name='price level'))
    • quantity
      PandasIndex
      PandasIndex(Index(['1 kg', '10 kg'], dtype='object', name='quantity'))
  • " ], "text/plain": [ " Size: 856B\n", @@ -809,15 +809,15 @@ "\n", "\n", "\n", - "
    scipp.Dataset (7.03 KB)
      • plants: 2
      • quantity: 2
      • price level: 2
      • plants
        (plants)
        string
        𝟙
        fruit, vegetable
        Values:
        ["fruit", "vegetable"]
      • plts
        (plants)
        string
        𝟙
        fr, ve
        Values:
        ["fr", "ve"]
      • price level
        (price level)
        string
        𝟙
        high, low
        Values:
        ["high", "low"]
      • product
        (plants, price level)
        string
        𝟙
        orange, apple, carrot, peppers
        Values:
        ["orange", "apple", "carrot", "peppers"]
      • quantity
        (quantity)
        string
        𝟙
        1 kg, 10 kg
        Values:
        ["1 kg", "10 kg"]
      • valid
        ()
        string
        𝟙
        ok
        Values:
        'ok'
      • group
        (plants, quantity, price level)
        string
        𝟙
        fruit 1, fruit 1, ..., veget, veget
        Values:
        ["fruit 1", "fruit 1", ..., "veget", "veget"]
      • id
        (plants, quantity, price level)
        int64
        𝟙
        1003, 1001, ..., 1008, 1006
        Values:
        array([[[1003, 1001],\n", + "
        scipp.Dataset (7.03 KB)
          • plants: 2
          • quantity: 2
          • price level: 2
          • plants
            (plants)
            string
            𝟙
            fruit, vegetable
            Values:
            ["fruit", "vegetable"]
          • plts
            (plants)
            string
            𝟙
            fr, ve
            Values:
            ["fr", "ve"]
          • price level
            (price level)
            string
            𝟙
            high, low
            Values:
            ["high", "low"]
          • product
            (plants, price level)
            string
            𝟙
            orange, apple, carrot, peppers
            Values:
            ["orange", "apple", "carrot", "peppers"]
          • quantity
            (quantity)
            string
            𝟙
            1 kg, 10 kg
            Values:
            ["1 kg", "10 kg"]
          • valid
            ()
            string
            𝟙
            ok
            Values:
            'ok'
          • group
            (plants, quantity, price level)
            string
            𝟙
            fruit 1, fruit 1, ..., veget, veget
            Values:
            ["fruit 1", "fruit 1", ..., "veget", "veget"]
          • id
            (plants, quantity, price level)
            int64
            𝟙
            1003, 1001, ..., 1008, 1006
            Values:
            array([[[1003, 1001],\n", " [1004, 1002]],\n", "\n", " [[1007, 1005],\n", - " [1008, 1006]]], dtype=int64)
          • location
            (plants, quantity, price level)
            string
            𝟙
            es, fr, ..., ch, fr
            Values:
            ["es", "fr", ..., "ch", "fr"]
          • price
            (plants, quantity, price level)
            float64
            𝟙
            2.0, 1.0, ..., 20.0, 15.0
            Values:
            array([[[ 2. , 1. ],\n", + " [1008, 1006]]], dtype=int64)
          • location
            (plants, quantity, price level)
            string
            𝟙
            es, fr, ..., ch, fr
            Values:
            ["es", "fr", ..., "ch", "fr"]
          • price
            (plants, quantity, price level)
            float64
            𝟙
            2.0, 1.0, ..., 20.0, 15.0
            Values:
            array([[[ 2. , 1. ],\n", " [20. , 10. ]],\n", "\n", " [[ 1.5, 1.5],\n", - " [20. , 15. ]]])
          • supplier
            (plants, quantity, price level)
            string
            𝟙
            sup1, sup1, ..., sup1, sup2
            Values:
            ["sup1", "sup1", ..., "sup1", "sup2"]
      " + " [20. , 15. ]]])
    • supplier
      (plants, quantity, price level)
      string
      𝟙
      sup1, sup1, ..., sup1, sup2
      Values:
      ["sup1", "sup1", ..., "sup1", "sup2"]
    " ], "text/plain": [ "\n", @@ -1267,22 +1267,22 @@ " id (product, quantity) int64 64B 1001 1002 1007 ... 1004 1005 1006\n", " location (product, quantity) <U2 64B 'fr' 'gb' 'es' ... 'ch' 'gb' 'fr'\n", " price (product, quantity) float64 64B 1.0 10.0 1.5 ... 20.0 1.5 15.0\n", - " supplier (product, quantity) <U4 128B 'sup1' 'sup1' ... 'sup2' 'sup2'
    • product
      PandasIndex
      PandasIndex(Index(['apple', 'carrot', 'orange', 'peppers'], dtype='object', name='product'))
    • quantity
      PandasIndex
      PandasIndex(Index(['1 kg', '10 kg'], dtype='object', name='quantity'))
  • " ], "text/plain": [ " Size: 976B\n", @@ -1367,13 +1367,13 @@ "\n", "\n", "\n", - "
    scipp.Dataset (7.24 KB)
      • product: 4
      • quantity: 2
      • plants
        (product)
        string
        𝟙
        fruit, vegetable, fruit, vegetable
        Values:
        ["fruit", "vegetable", "fruit", "vegetable"]
      • plts
        (product)
        string
        𝟙
        fr, ve, fr, ve
        Values:
        ["fr", "ve", "fr", "ve"]
      • price level
        (product)
        string
        𝟙
        low, high, high, low
        Values:
        ["low", "high", "high", "low"]
      • product
        (product)
        string
        𝟙
        apple, carrot, orange, peppers
        Values:
        ["apple", "carrot", "orange", "peppers"]
      • quantity
        (quantity)
        string
        𝟙
        1 kg, 10 kg
        Values:
        ["1 kg", "10 kg"]
      • valid
        ()
        string
        𝟙
        ok
        Values:
        'ok'
      • group
        (product, quantity)
        string
        𝟙
        fruit 1, fruit 10, ..., veget, veget
        Values:
        ["fruit 1", "fruit 10", ..., "veget", "veget"]
      • id
        (product, quantity)
        int64
        𝟙
        1001, 1002, ..., 1005, 1006
        Values:
        array([[1001, 1002],\n", + "
        scipp.Dataset (7.24 KB)
          • product: 4
          • quantity: 2
          • plants
            (product)
            string
            𝟙
            fruit, vegetable, fruit, vegetable
            Values:
            ["fruit", "vegetable", "fruit", "vegetable"]
          • plts
            (product)
            string
            𝟙
            fr, ve, fr, ve
            Values:
            ["fr", "ve", "fr", "ve"]
          • price level
            (product)
            string
            𝟙
            low, high, high, low
            Values:
            ["low", "high", "high", "low"]
          • product
            (product)
            string
            𝟙
            apple, carrot, orange, peppers
            Values:
            ["apple", "carrot", "orange", "peppers"]
          • quantity
            (quantity)
            string
            𝟙
            1 kg, 10 kg
            Values:
            ["1 kg", "10 kg"]
          • valid
            ()
            string
            𝟙
            ok
            Values:
            'ok'
          • group
            (product, quantity)
            string
            𝟙
            fruit 1, fruit 10, ..., veget, veget
            Values:
            ["fruit 1", "fruit 10", ..., "veget", "veget"]
          • id
            (product, quantity)
            int64
            𝟙
            1001, 1002, ..., 1005, 1006
            Values:
            array([[1001, 1002],\n", " [1007, 1008],\n", " [1003, 1004],\n", - " [1005, 1006]], dtype=int64)
          • location
            (product, quantity)
            string
            𝟙
            fr, gb, ..., gb, fr
            Values:
            ["fr", "gb", ..., "gb", "fr"]
          • price
            (product, quantity)
            float64
            𝟙
            1.0, 10.0, ..., 1.5, 15.0
            Values:
            array([[ 1. , 10. ],\n", + " [1005, 1006]], dtype=int64)
          • location
            (product, quantity)
            string
            𝟙
            fr, gb, ..., gb, fr
            Values:
            ["fr", "gb", ..., "gb", "fr"]
          • price
            (product, quantity)
            float64
            𝟙
            1.0, 10.0, ..., 1.5, 15.0
            Values:
            array([[ 1. , 10. ],\n", " [ 1.5, 20. ],\n", " [ 2. , 20. ],\n", - " [ 1.5, 15. ]])
          • supplier
            (product, quantity)
            string
            𝟙
            sup1, sup1, ..., sup2, sup2
            Values:
            ["sup1", "sup1", ..., "sup2", "sup2"]
      " + " [ 1.5, 15. ]])
    • supplier
      (product, quantity)
      string
      𝟙
      sup1, sup1, ..., sup2, sup2
      Values:
      ["sup1", "sup1", ..., "sup2", "sup2"]
    " ], "text/plain": [ "\n", diff --git a/ntv_pandas/__init__.py b/ntv_pandas/__init__.py index 2029fe8..c2160cd 100644 --- a/ntv_pandas/__init__.py +++ b/ntv_pandas/__init__.py @@ -24,12 +24,21 @@ - `ntv-pandas.ntv_pandas.accessors.NpdSeriesAccessor` - `ntv-pandas.ntv_pandas.accessors.NpdDataFrameAccessor` """ + from ntv_pandas.pandas_ntv_connector import DataFrameConnec, SeriesConnec, read_json from ntv_pandas.pandas_ntv_connector import to_json, as_def_type, equals, to_analysis from ntv_pandas.pandas_ntv_connector import from_xarray, from_scipp import ntv_pandas.pandas_accessors as pandas_accessors -__all__ = ['DataFrameConnec', 'SeriesConnec', 'read_json', - 'to_json', 'as_def_type', 'equals', 'to_analysis', - 'from_xarray', 'from_scipp', - 'pandas_accessors'] +__all__ = [ + "DataFrameConnec", + "SeriesConnec", + "read_json", + "to_json", + "as_def_type", + "equals", + "to_analysis", + "from_xarray", + "from_scipp", + "pandas_accessors", +]