Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [],
- "source": [
- "import pandas as pd\n",
- "import re"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [],
- "source": [
- "df = pd.read_excel(\"data/mercedes_benz.xlsx\", header=None)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [],
- "source": [
- "df = df[df[0].str.find(\"name\") == 1]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "0 170\n",
- "6 180\n",
- "12 190\n",
- "18 200\n",
- "24 208\n",
- "30 210/310\n",
- "36 220\n",
- "42 230\n",
- "48 240\n",
- "54 250\n",
- "60 260\n",
- "66 270\n",
- "72 280\n",
- "78 300\n",
- "84 308\n",
- "90 320\n",
- "96 350\n",
- "102 380\n",
- "108 400\n",
- "114 416\n",
- "120 420\n",
- "126 450\n",
- "132 500\n",
- "138 560\n",
- "144 600\n",
- "150 A Series (all)\n",
- "156 A 140\n",
- "162 A 150\n",
- "168 A 160\n",
- "174 A 170\n",
- " ... \n",
- "1716 SLK 200\n",
- "1722 SLK 230\n",
- "1728 SLK 250\n",
- "1734 SLK 280\n",
- "1740 SLK 300\n",
- "1746 SLK 32 AMG\n",
- "1752 SLK 320\n",
- "1758 SLK 350\n",
- "1764 SLK 55 AMG\n",
- "1770 SLR\n",
- "1776 SLS\n",
- "1782 Sprinter\n",
- "1788 T1\n",
- "1794 T2\n",
- "1800 V Series (all)\n",
- "1806 V\n",
- "1812 V 200\n",
- "1818 V 220\n",
- "1824 V 230\n",
- "1830 V 250\n",
- "1836 V 280\n",
- "1842 Vaneo\n",
- "1848 Vario\n",
- "1854 Viano\n",
- "1860 Vito\n",
- "1866 X Series (all)\n",
- "1872 X 220\n",
- "1878 X 250\n",
- "1884 X 350\n",
- "1890 Others\n",
- "Name: 0, Length: 316, dtype: object"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "df[0].str[10:-2]"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.6.8"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement