You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/07 12:57:46 UTC

[GitHub] [arrow] jorisvandenbossche commented on a diff in pull request #12821: ARROW-7914: [Python] Allow pandas datetime as index for feather

jorisvandenbossche commented on code in PR #12821:
URL: https://github.com/apache/arrow/pull/12821#discussion_r845103205


##########
python/pyarrow/feather.py:
##########
@@ -151,7 +151,17 @@ def write_feather(df, dest, compression=None, compression_level=None,
             df = df.to_dense()
 
     if _pandas_api.is_data_frame(df):
-        table = Table.from_pandas(df, preserve_index=False)
+        """
+        Feather v1 creates a new column in the resulting Table for 
+        storing index.
+        """
+        if version == 1:
+            preserve_index = False
+
+        else:
+            preserve_index = True

Review Comment:
   I think you can use `preserve_index=None` here. In practice, that almost means the same, except that for pandas' default RangeIndex it stores this information more efficiently (as metadata instead of an actual column). 
   
   See https://arrow.apache.org/docs/python/pandas.html#handling-pandas-indexes / https://arrow.apache.org/docs/python/generated/pyarrow.Table.html#pyarrow.Table.from_pandas



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org