Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 10,
  6. "metadata": {},
  7. "outputs": [
  8. {
  9. "data": {
  10. "text/html": [
  11. "<div>\n",
  12. "<style scoped>\n",
  13. " .dataframe tbody tr th:only-of-type {\n",
  14. " vertical-align: middle;\n",
  15. " }\n",
  16. "\n",
  17. " .dataframe tbody tr th {\n",
  18. " vertical-align: top;\n",
  19. " }\n",
  20. "\n",
  21. " .dataframe thead th {\n",
  22. " text-align: right;\n",
  23. " }\n",
  24. "</style>\n",
  25. "<table border=\"1\" class=\"dataframe\">\n",
  26. " <thead>\n",
  27. " <tr style=\"text-align: right;\">\n",
  28. " <th>Survived</th>\n",
  29. " <th>0</th>\n",
  30. " <th>1</th>\n",
  31. " </tr>\n",
  32. " <tr>\n",
  33. " <th>Sex</th>\n",
  34. " <th></th>\n",
  35. " <th></th>\n",
  36. " </tr>\n",
  37. " </thead>\n",
  38. " <tbody>\n",
  39. " <tr>\n",
  40. " <th>female</th>\n",
  41. " <td>81</td>\n",
  42. " <td>233</td>\n",
  43. " </tr>\n",
  44. " <tr>\n",
  45. " <th>male</th>\n",
  46. " <td>468</td>\n",
  47. " <td>109</td>\n",
  48. " </tr>\n",
  49. " </tbody>\n",
  50. "</table>\n",
  51. "</div>"
  52. ],
  53. "text/plain": [
  54. "Survived 0 1\n",
  55. "Sex \n",
  56. "female 81 233\n",
  57. "male 468 109"
  58. ]
  59. },
  60. "execution_count": 10,
  61. "metadata": {},
  62. "output_type": "execute_result"
  63. }
  64. ],
  65. "source": [
  66. "titanic.pivot_table(\"Counts\",[\"Sex\"],[\"Survived\"], aggfunc = np.sum)\n",
  67. "# titanic.pivot_table(\"Counts\",\"Sex\",\"Survived\", aggfunc = np.sum)"
  68. ]
  69. }
  70. ],
  71. "metadata": {
  72. "kernelspec": {
  73. "display_name": "Python 3",
  74. "language": "python",
  75. "name": "python3"
  76. },
  77. "language_info": {
  78. "codemirror_mode": {
  79. "name": "ipython",
  80. "version": 3
  81. },
  82. "file_extension": ".py",
  83. "mimetype": "text/x-python",
  84. "name": "python",
  85. "nbconvert_exporter": "python",
  86. "pygments_lexer": "ipython3",
  87. "version": "3.6.5"
  88. }
  89. },
  90. "nbformat": 4,
  91. "nbformat_minor": 2
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement