Project Name: altair-viz+altair
Language: Python
Statement Type: Branch

Source Code:
def to_values(data: DataType) -> ToValuesReturnType:
    """Replace a DataFrame by a data model with values."""
    check_data_type(data)
    if hasattr(data, "__geo_interface__"):
        if isinstance(data, pd.DataFrame):
            data = sanitize_dataframe(data)
        # Maybe the type could be further clarified here that it is
        # SupportGeoInterface and then the ignore statement is not needed?
        data_sanitized = sanitize_geo_interface(data.__geo_interface__)  # type: ignore[arg-type]
        return {"values": data_sanitized}
    elif isinstance(data, pd.DataFrame):
        data = sanitize_dataframe(data)
        return {"values": data.to_dict(orient="records")}
    elif isinstance(data, dict):
        if "values" not in data:
            raise KeyError("values expected in data dict, but not present.")
        return data
    elif hasattr(data, "__dataframe__"):
        # experimental interchange dataframe support
        pi = import_pyarrow_interchange()
        pa_table = sanitize_arrow_table(pi.from_dataframe(data))
        return {"values": pa_table.to_pylist()}
    else:
        # Should never reach this state as tested by check_data_type
        raise ValueError("Unrecognized data type: {}".format(type(data)))

to_values(data=           date  precipitation  temp_max  temp_min  wind  weather0    2012-01-01            0.0      12.8       5.0   4.7  drizzle1    2012-01-02           10.9      10.6       2.8   4.5     rain2    2012-01-03            0.8      11.7       7.2   2.3     rain3    2012-01-04           20.3      12.2       5.6   4.7     rain4    2012-01-05            1.3       8.9       2.8   6.1     rain...         ...            ...       ...       ...   ...      ...1456 2015-12-27            8.6       4.4       1.7   2.9      fog1457 2015-12-28            1.5       5.0       1.7   1.3      fog1458 2015-12-29            0.0       7.2       0.6   2.6      fog1459 2015-12-30            0.0       5.6      -1.0   3.4      sun1460 2015-12-31            0.0       5.6      -2.1   3.5      sun[1461 rows x 6 columns])

Selected Statement: if "values" not in data:

Function Input:
data:            date  precipitation  temp_max  temp_min  wind  weather0    2012-01-01            0.0      12.8       5.0   4.7  drizzle1    2012-01-02           10.9      10.6       2.8   4.5     rain2    2012-01-03            0.8      11.7       7.2   2.3     rain3    2012-01-04           20.3      12.2       5.6   4.7     rain4    2012-01-05            1.3       8.9       2.8   6.1     rain...         ...            ...       ...       ...   ...      ...1456 2015-12-27            8.6       4.4       1.7   2.9      fog1457 2015-12-28            1.5       5.0       1.7   1.3      fog1458 2015-12-29            0.0       7.2       0.6   2.6      fog1459 2015-12-30            0.0       5.6      -1.0   3.4      sun1460 2015-12-31            0.0       5.6      -2.1   3.5      sun[1461 rows x 6 columns]

Variable Values Before Statement:
data:                      date precipitation temp_max temp_min wind  weather0     2012-01-01T00:00:00           0.0     12.8      5.0  4.7  drizzle1     2012-01-02T00:00:00          10.9     10.6      2.8  4.5     rain2     2012-01-03T00:00:00           0.8     11.7      7.2  2.3     rain3     2012-01-04T00:00:00          20.3     12.2      5.6  4.7     rain4     2012-01-05T00:00:00           1.3      8.9      2.8  6.1     rain...                   ...           ...      ...      ...  ...      ...1456  2015-12-27T00:00:00           8.6      4.4      1.7  2.9      fog1457  2015-12-28T00:00:00           1.5      5.0      1.7  1.3      fog1458  2015-12-29T00:00:00           0.0      7.2      0.6  2.6      fog1459  2015-12-30T00:00:00           0.0      5.6     -1.0  3.4      sun1460  2015-12-31T00:00:00           0.0      5.6     -2.1  3.5      sun[1461 rows x 6 columns]

Value After Statement Execution: No

Variable States During Runtime (line, value):
data: 1
           date  precipitation  temp_max  temp_min  wind  weather0    2012-01-01            0.0      12.8       5.0   4.7  drizzle1    2012-01-02           10.9      10.6       2.8   4.5     rain2    2012-01-03            0.8      11.7       7.2   2.3     rain3    2012-01-04           20.3      12.2       5.6   4.7     rain4    2012-01-05            1.3       8.9       2.8   6.1     rain...         ...            ...       ...       ...   ...      ...1456 2015-12-27            8.6       4.4       1.7   2.9      fog1457 2015-12-28            1.5       5.0       1.7   1.3      fog1458 2015-12-29            0.0       7.2       0.6   2.6      fog1459 2015-12-30            0.0       5.6      -1.0   3.4      sun1460 2015-12-31            0.0       5.6      -2.1   3.5      sun[1461 rows x 6 columns]
12
                     date precipitation temp_max temp_min wind  weather0     2012-01-01T00:00:00           0.0     12.8      5.0  4.7  drizzle1     2012-01-02T00:00:00          10.9     10.6      2.8  4.5     rain2     2012-01-03T00:00:00           0.8     11.7      7.2  2.3     rain3     2012-01-04T00:00:00          20.3     12.2      5.6  4.7     rain4     2012-01-05T00:00:00           1.3      8.9      2.8  6.1     rain...                   ...           ...      ...      ...  ...      ...1456  2015-12-27T00:00:00           8.6      4.4      1.7  2.9      fog1457  2015-12-28T00:00:00           1.5      5.0      1.7  1.3      fog1458  2015-12-29T00:00:00           0.0      7.2      0.6  2.6      fog1459  2015-12-30T00:00:00           0.0      5.6     -1.0  3.4      sun1460  2015-12-31T00:00:00           0.0      5.6     -2.1  3.5      sun[1461 rows x 6 columns]