This works for me on the current version of pandas:
pd.to_datetime(df)
0 2015-02-04
1 2016-03-05
dtype: datetime64[ns]
Pandas to_datetime has special support to parse a datetime column from a supplied DataFrame input iff it contains specifically "year", "month" and "day" columns (order doesn't matter, and case sensitivity doesn't either).
It's likely you're working with a much older version of pandas in which case I'd recommend an upgrade!
However...
If upgrading isn't an option, you can always join the columns and call to_datetime on the Series.
Try joining the columns and then applying pd.to_datetime.
pd.to_datetime(df[['year', 'month', 'day']].astype(str).apply('-'.join, 1))
0 2015-02-04
1 2016-03-05
dtype: datetime64[ns]
DataFrame.dtypes is an attribute to list data types, for series it's a dtype.
reference: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.dtypes.html
The function pd.read_csv() is already a DataFrame and thus that kind of object does not support calling .to_dataframe().
You can check the type of your variable ds using print(type(ds)), you will see that it is a pandas DataFrame type.
According to what I understand. You are loading loanapp_c.csv in ds using this code:
ds = pd.read_csv('desktop/python ML/loanapp_c.csv')
ds over here is a DataFrame object. What you are doing is calling to_dataframe on an object which a DataFrame already.
Removing this dataset = ds.to_dataframe() from your code should solve the error