def from_pandas(df): """ Convert a pandas DataFrame to a Modin DataFrame. Parameters ---------- df : pandas.DataFrame The pandas DataFrame to convert. Returns ------- modin.pandas.DataFrame A new Modin DataFrame object. """ from modin.data_management.factories.dispatcher import FactoryDispatcher from .dataframe import DataFrame return DataFrame(query_compiler=FactoryDispatcher.from_pandas(df))
def read_sql( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize=None, ): _, _, _, kwargs = inspect.getargvalues(inspect.currentframe()) from modin.data_management.factories.dispatcher import FactoryDispatcher Engine.subscribe(_update_engine) if kwargs.get("chunksize") is not None: ErrorMessage.default_to_pandas("Parameters provided [chunksize]") df_gen = pandas.read_sql(**kwargs) return (DataFrame(query_compiler=FactoryDispatcher.from_pandas(df)) for df in df_gen) return DataFrame(query_compiler=FactoryDispatcher.read_sql(**kwargs))