# Class GcsClient (2.20.0)

2.20.0 (latest) 2.19.0 2.18.1 2.17.0 2.16.4 2.15.0 2.14.1 2.13.5 2.12.0 2.11.4 2.10.1 2.9.0 2.8.3 2.7.3 2.6.0 2.5.2 2.4.2 2.3.0 2.2.0 2.1.0 2.0.0 1.0.3 0.10.0 0.9.0 0.8.0 0.7.1 0.6.0 0.5.0 0.4.0

    GcsClient(bucket_name=None, client=None, credentials=None, project=None)

Uploads Pandas DataFrame to a bucket in Google Cloud Storage.

## Methods

### GcsClient

    GcsClient(bucket_name=None, client=None, credentials=None, project=None)

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `bucket_name` | `Optional[str]` The name of Google Cloud Storage bucket for this client to send requests to. |
| `client` | `Optional[storage.Client]` A Google Cloud Storage Client instance. |
| `credentials` | `Optional[google.auth.credentials.Credentials]` The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. |
| `project` | `Optional[str]` The project ID of the GCP project to attach to the underlying storage client. If none is specified, the client will attempt to ascertain the credentials from the environment. |

### ensure_bucket_exists

    ensure_bucket_exists(project, region)

Checks if a bucket named '{project}-automl-tables-staging' exists.

If this bucket doesn't exist, creates one.
If this bucket already exists in `project`, do nothing.
If this bucket exists in a different project that we don't have
access to, creates a bucket named
'{project}-automl-tables-staging-{create_timestamp}' because bucket's
name must be globally unique.
Save the created bucket's name and reuse this for future requests.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `str` The ID of the project that stores the bucket. |
| `region` | `str` The region of the bucket. |

### upload_pandas_dataframe

    upload_pandas_dataframe(dataframe, uploaded_csv_name=None)

Uploads a Pandas DataFrame as CSV to the bucket.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `dataframe` | `pandas.DataFrame` The Pandas Dataframe to be uploaded. |
| `uploaded_csv_name` | `Optional[str]` The name for the uploaded CSV. |