Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 1,
  6. "metadata": {},
  7. "outputs": [],
  8. "source": [
  9. "import pandas as pd\n",
  10. "import re"
  11. ]
  12. },
  13. {
  14. "cell_type": "code",
  15. "execution_count": 2,
  16. "metadata": {},
  17. "outputs": [],
  18. "source": [
  19. "df = pd.read_excel(\"data/mercedes_benz.xlsx\", header=None)"
  20. ]
  21. },
  22. {
  23. "cell_type": "code",
  24. "execution_count": 3,
  25. "metadata": {},
  26. "outputs": [],
  27. "source": [
  28. "df = df[df[0].str.find(\"name\") == 1]"
  29. ]
  30. },
  31. {
  32. "cell_type": "code",
  33. "execution_count": 4,
  34. "metadata": {},
  35. "outputs": [
  36. {
  37. "data": {
  38. "text/plain": [
  39. "0 170\n",
  40. "6 180\n",
  41. "12 190\n",
  42. "18 200\n",
  43. "24 208\n",
  44. "30 210/310\n",
  45. "36 220\n",
  46. "42 230\n",
  47. "48 240\n",
  48. "54 250\n",
  49. "60 260\n",
  50. "66 270\n",
  51. "72 280\n",
  52. "78 300\n",
  53. "84 308\n",
  54. "90 320\n",
  55. "96 350\n",
  56. "102 380\n",
  57. "108 400\n",
  58. "114 416\n",
  59. "120 420\n",
  60. "126 450\n",
  61. "132 500\n",
  62. "138 560\n",
  63. "144 600\n",
  64. "150 A Series (all)\n",
  65. "156 A 140\n",
  66. "162 A 150\n",
  67. "168 A 160\n",
  68. "174 A 170\n",
  69. " ... \n",
  70. "1716 SLK 200\n",
  71. "1722 SLK 230\n",
  72. "1728 SLK 250\n",
  73. "1734 SLK 280\n",
  74. "1740 SLK 300\n",
  75. "1746 SLK 32 AMG\n",
  76. "1752 SLK 320\n",
  77. "1758 SLK 350\n",
  78. "1764 SLK 55 AMG\n",
  79. "1770 SLR\n",
  80. "1776 SLS\n",
  81. "1782 Sprinter\n",
  82. "1788 T1\n",
  83. "1794 T2\n",
  84. "1800 V Series (all)\n",
  85. "1806 V\n",
  86. "1812 V 200\n",
  87. "1818 V 220\n",
  88. "1824 V 230\n",
  89. "1830 V 250\n",
  90. "1836 V 280\n",
  91. "1842 Vaneo\n",
  92. "1848 Vario\n",
  93. "1854 Viano\n",
  94. "1860 Vito\n",
  95. "1866 X Series (all)\n",
  96. "1872 X 220\n",
  97. "1878 X 250\n",
  98. "1884 X 350\n",
  99. "1890 Others\n",
  100. "Name: 0, Length: 316, dtype: object"
  101. ]
  102. },
  103. "execution_count": 4,
  104. "metadata": {},
  105. "output_type": "execute_result"
  106. }
  107. ],
  108. "source": [
  109. "df[0].str[10:-2]"
  110. ]
  111. }
  112. ],
  113. "metadata": {
  114. "kernelspec": {
  115. "display_name": "Python 3",
  116. "language": "python",
  117. "name": "python3"
  118. },
  119. "language_info": {
  120. "codemirror_mode": {
  121. "name": "ipython",
  122. "version": 3
  123. },
  124. "file_extension": ".py",
  125. "mimetype": "text/x-python",
  126. "name": "python",
  127. "nbconvert_exporter": "python",
  128. "pygments_lexer": "ipython3",
  129. "version": "3.6.8"
  130. }
  131. },
  132. "nbformat": 4,
  133. "nbformat_minor": 2
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement