Check if *x* is a Pandas DataFrame.
(x)
| 2464 | |
| 2465 | |
| 2466 | def _is_pandas_dataframe(x): |
| 2467 | """Check if *x* is a Pandas DataFrame.""" |
| 2468 | try: |
| 2469 | # We're intentionally not attempting to import Pandas. If somebody |
| 2470 | # has created a Pandas DataFrame, Pandas should already be in sys.modules. |
| 2471 | tp = sys.modules.get("pandas").DataFrame |
| 2472 | except AttributeError: |
| 2473 | return False # Module not imported or a nonstandard module with no Array attr. |
| 2474 | return (isinstance(tp, type) # Just in case it's a very nonstandard module. |
| 2475 | and isinstance(x, tp)) |
| 2476 | |
| 2477 | |
| 2478 | def _is_tensorflow_array(x): |