Skip to content

Instantly share code, notes, and snippets.

@tanveer-sayyed
Created February 13, 2019 08:05
Show Gist options
  • Save tanveer-sayyed/22f10a41346817ae582290a25ae6a72c to your computer and use it in GitHub Desktop.
Save tanveer-sayyed/22f10a41346817ae582290a25ae6a72c to your computer and use it in GitHub Desktop.
In [59]:
print('Data types:\n', new_df.dtypes)
# (Although such an assignment is not correct, but the purpose here is to
# demonstrate use of mean/median/mode academically so let's continue with it)
new_df.loc['i2', 'c3'] = 10
new_df['c3'] = new_df['c3'].astype('float64') # if skipped a warning would be thrown
# as '#$%' was a string.
print('\n Data types(after):\n', new_df.dtypes)
Out [59]:
Data types:
c0 float64
c1 float64
c2 float64
c3 object
dtype: object
Data types(after):
c0 float64
c1 float64
c2 float64
c3 float64
dtype: object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment