import pandas as pd
import os

from .datasource import Datasource
from .filesystem_path_generator import FilesystemPathGenerator
from ...dataset.pandas_dataset import PandasDataset

class PandasCSVDatasource(Datasource):
    """
    A PandasDataSource makes it easy to create, manage and validate expectations on
    Pandas dataframes.

    Use with the FilesystemPathGenerator for simple cases.
    """

    def __init__(self, name, type_, data_context=None, generators=None, base_directory="/data", read_csv_kwargs=None):
        self._base_directory = base_directory
        if generators is None:
            generators = {
                "default": {"type": "filesystem", "base_directory": "/data"}
        }
        super(PandasCSVDatasource, self).__init__(name, type_, data_context, generators)
        self._datasource_config.update(
            {
                "base_directory": base_directory,
                "read_csv_kwargs": read_csv_kwargs or {}
            }
        )
        self._build_generators()

    def _get_generator_class(self, type_):
        if type_ == "filesystem":
            return FilesystemPathGenerator
        else:
            raise ValueError("Unrecognized BatchGenerator type %s" % type_)

    def _get_data_asset(self, data_asset_name, batch_kwargs, expectations_config):
        full_path = os.path.join(batch_kwargs["path"])
        df = pd.read_csv(full_path, **self._datasource_config["read_csv_kwargs"])
        
        return PandasDataset(df, 
            expectations_config=expectations_config, 
            data_context=self._data_context, 
            data_asset_name=data_asset_name, 
            batch_kwargs=batch_kwargs)

import pandas as pd
import os

from .datasource import Datasource
from .filesystem_path_generator import FilesystemPathGenerator
from ...dataset.pandas_dataset import PandasDataset

class PandasCSVDatasource(Datasource):
    """
    A PandasDataSource makes it easy to create, manage and validate expectations on
    Pandas dataframes.

    Use with the FilesystemPathGenerator for simple cases.
    """

    def __init__(self, name, type_, data_context=None, generators=None, read_csv_kwargs=None):
        if generators is None:
            generators = {
                "default": {"type": "filesystem", "base_directory": "/data"}
        }
        super(PandasCSVDatasource, self).__init__(name, type_, data_context, generators)
        self._datasource_config.update(
            {
                "read_csv_kwargs": read_csv_kwargs or {}
            }
        )
        self._build_generators()

    def _get_generator_class(self, type_):
        if type_ == "filesystem":
            return FilesystemPathGenerator
        else:
            raise ValueError("Unrecognized BatchGenerator type %s" % type_)

    def _get_data_asset(self, data_asset_name, batch_kwargs, expectations_config):
        full_path = os.path.join(batch_kwargs["path"])
        df = pd.read_csv(full_path, **self._datasource_config["read_csv_kwargs"])
        
        return PandasDataset(df, 
            expectations_config=expectations_config, 
            data_context=self._data_context, 
            data_asset_name=data_asset_name, 
            batch_kwargs=batch_kwargs)

Change base_directory location