Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-9376

[Python] RecordBatch.from_arrays: PyCharm inspection problems with the types of parameters passed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • 0.17.1
    • None
    • Python
    • None

    Description

      First try

       data = [pa.array([1, 2, 3, 4]), pa.array(['foo', 'bar', 'baz', None]), pa.array([True, None, False, True])]
       batch = pa.RecordBatch.from_arrays(data, ['f0', 'f1', 'f2'])
      

      Hi, I use PyCharm IDE for development and I am getting the following inspection description when I write this piece of code above in the editor.

      Expected type 'RecordBatch', got 'List[Union[Union[ChunkedArray, Array], Any]]' instead

      Inspection info: This inspection detects type errors in function call expressions. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Types of function parameters can be specified in docstrings or in Python 3 function annotations.

      Second try

      batch = pa.RecordBatch.from_arrays(data, names=['f0', 'f1', 'f2'])

      Then you get an insection descriptions

      Parameter 'list_arrays' unfilled

      Passing list instead of pyarrow.lib.RecordBatch.RecordBatch. Is this intentional?

      Third try

      batch = pa.RecordBatch.from_arrays(list_arrays=data, names=['f0', 'f1', 'f2'])
      

      Then you get an insection description and a type error

      Parameter 'self' unfilled
      TypeError: from_arrays() takes at least 1 positional argument (0 given) 

       

      Similar response, behaviour happens with the pa.Table.from_arrays

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            athanassios Athanassios Hatzis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: