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

[C++][Python] Timedelta dtype metadata base unit is globally mutated by the Table.to_pandas() method

    XMLWordPrintableJSON

Details

    Description

      Here's a failing test case to demonstrate the issue:

      def test_mutates_dtype():
          import pyarrow as pa
      
          expected = np.dtype('<m8')
      
          assert np.dtype(np.timedelta64) == expected
      
          df = pd.DataFrame({"a": [np.timedelta64()]})
          t = pa.Table.from_pandas(df)
          t.to_pandas()
      
          assert np.dtype(np.timedelta64) == expected
      

      Attachments

        Issue Links

          Activity

            People

              cpcloud Phillip Cloud
              cpcloud Phillip Cloud
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m