You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2024/01/08 09:26:26 UTC

[PR] [WIP][SPARK-46620][PS][CONNECT] Implement `Frame.asfreq` [spark]

zhengruifeng opened a new pull request, #44621:
URL: https://github.com/apache/spark/pull/44621

   ### What changes were proposed in this pull request?
   Implement `Frame.asfreq`
   
   
   ### Why are the changes needed?
   for feature parity
   
   
   ### Does this PR introduce _any_ user-facing change?
   yes
   
   ```
   In [1]: import pyspark.pandas as ps
   
   In [2]: import pandas as pd
   
   In [3]: index = pd.date_range('1/1/2000', periods=4, freq='min')
   
   In [4]: series = pd.Series([0.0, None, 2.0, 3.0], index=index)
   
   In [5]: pdf = pd.DataFrame({'s': series})
   
   In [6]: psdf = ps.from_pandas(pdf)
   24/01/08 17:25:19 WARN CheckAllocator: More than one DefaultAllocationManager on classpath. Choosing first found
   
   In [7]: psdf.asfreq(freq='30s')
   /Users/ruifeng.zheng/Dev/spark/python/pyspark/pandas/utils.py:1015: PandasAPIOnSparkAdviceWarning: `frame.asfreq` loads partial data into the driver's memory to infer the schema, and loads all data into one executor's memory to compute. It should only be used if the pandas DataFrame is expected to be small.
     warnings.warn(message, PandasAPIOnSparkAdviceWarning)
   /Users/ruifeng.zheng/Dev/spark/python/pyspark/pandas/utils.py:1015: PandasAPIOnSparkAdviceWarning: If the type hints is not specified for `groupby.apply`, it is expensive to infer the data type internally.
     warnings.warn(message, PandasAPIOnSparkAdviceWarning)
   Out[7]: 
                          s
   2000-01-01 00:00:00  0.0
   2000-01-01 00:00:30  NaN
   2000-01-01 00:01:00  NaN
   2000-01-01 00:01:30  NaN
   2000-01-01 00:02:00  2.0
   2000-01-01 00:02:30  NaN
   2000-01-01 00:03:00  3.0
   
   In [8]: psdf.asfreq(freq='30s', fill_value=9.0)
   /Users/ruifeng.zheng/Dev/spark/python/pyspark/pandas/utils.py:1015: PandasAPIOnSparkAdviceWarning: `frame.asfreq` loads partial data into the driver's memory to infer the schema, and loads all data into one executor's memory to compute. It should only be used if the pandas DataFrame is expected to be small.
     warnings.warn(message, PandasAPIOnSparkAdviceWarning)
   /Users/ruifeng.zheng/Dev/spark/python/pyspark/pandas/utils.py:1015: PandasAPIOnSparkAdviceWarning: If the type hints is not specified for `groupby.apply`, it is expensive to infer the data type internally.
     warnings.warn(message, PandasAPIOnSparkAdviceWarning)
   Out[8]: 
                          s
   2000-01-01 00:00:00  0.0
   2000-01-01 00:00:30  9.0
   2000-01-01 00:01:00  NaN
   2000-01-01 00:01:30  9.0
   2000-01-01 00:02:00  2.0
   2000-01-01 00:02:30  9.0
   2000-01-01 00:03:00  3.0
   
   In [9]: psdf.asfreq(freq='30s', method='bfill')
   /Users/ruifeng.zheng/Dev/spark/python/pyspark/pandas/utils.py:1015: PandasAPIOnSparkAdviceWarning: `frame.asfreq` loads partial data into the driver's memory to infer the schema, and loads all data into one executor's memory to compute. It should only be used if the pandas DataFrame is expected to be small.
     warnings.warn(message, PandasAPIOnSparkAdviceWarning)
   /Users/ruifeng.zheng/Dev/spark/python/pyspark/pandas/utils.py:1015: PandasAPIOnSparkAdviceWarning: If the type hints is not specified for `groupby.apply`, it is expensive to infer the data type internally.
     warnings.warn(message, PandasAPIOnSparkAdviceWarning)
   Out[9]: 
                          s
   2000-01-01 00:00:00  0.0
   2000-01-01 00:00:30  NaN
   2000-01-01 00:01:00  NaN
   2000-01-01 00:01:30  2.0
   2000-01-01 00:02:00  2.0
   2000-01-01 00:02:30  3.0
   2000-01-01 00:03:00  3.0
   
   ```
   
   ### How was this patch tested?
   doc test and ut
   
   ### Was this patch authored or co-authored using generative AI tooling?
   no
   


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [WIP][SPARK-46620][PS][CONNECT] Implement `Frame.asfreq` [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #44621: [WIP][SPARK-46620][PS][CONNECT] Implement `Frame.asfreq`
URL: https://github.com/apache/spark/pull/44621


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [WIP][SPARK-46620][PS][CONNECT] Implement `Frame.asfreq` [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #44621:
URL: https://github.com/apache/spark/pull/44621#issuecomment-2067823584

   We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org