def test_filesystem_protocol(df, tmp_path): # For now, hardcodes "tmp_path" to force the path to be POSIX; non-POSIX paths (from a real tmp_path) not yet supported. p = 5 # Use an in-memory filesystem protocol path = "memory://tmp_path/spatial_points_1.parquet" dsp.to_parquet(df, path, 'x', 'y', p=p, npartitions=2) spf = dsp.read_parquet(path) assert isinstance(spf, dsp.SpatialPointsFrame)
def test_validate_parquet_file(df, tmp_path): # Work around https://bugs.python.org/issue33617 tmp_path = str(tmp_path) # Write DataFrame to parquet filename = os.path.join(tmp_path, 'df.parquet') ddf = dd.from_pandas(df, npartitions=4) ddf.to_parquet(filename, engine='fastparquet') # Try to construct a SpatialPointsFrame from it spf = dsp.read_parquet(filename) assert spf.spatial is None
def s_points_frame(request, tmp_path, df): # Work around https://bugs.python.org/issue33617 tmp_path = str(tmp_path) p = 5 path = os.path.join(tmp_path, 'spatial_points.parquet') dsp.to_parquet(df, path, 'x', 'y', p=p, npartitions=10) spf = dsp.read_parquet(path) if request.param: spf = spf.persist() return spf