In [1]:
import pandas as pd
In [2]:
df_mix = pd.DataFrame({'col_int': [0, 1, 2], 'col_float': [0.1, 0.2, 0.3]}, index=['A', 'B', 'C'])
print(df_mix)
In [3]:
print(df_mix.dtypes)
In [4]:
print(df_mix['col_int'] + df_mix['col_float'])
In [5]:
print(df_mix / 1)
In [6]:
print((df_mix / 1).dtypes)
In [7]:
print(df_mix * 1)
In [8]:
print((df_mix * 1).dtypes)
In [9]:
print(df_mix * 1.0)
In [10]:
print((df_mix * 1.0).dtypes)
In [11]:
print(df_mix.loc['A'])
In [12]:
print(df_mix.T)
In [13]:
print(df_mix.T.dtypes)
In [14]:
df_mix.at['A', 'col_int'] = 10.9
df_mix.at['A', 'col_float'] = 10
print(df_mix)
In [15]:
print(df_mix.dtypes)
In [16]:
# df_mix.at['A', 'col_int'] = 'abc'
# ValueError: invalid literal for int() with base 10: 'abc'