{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# csv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import csv\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "names = ['ali', 'ahmad', 'akbar', 'leila', 'maryam', 'zahra']\n",
    "score = [12, 15, 18, 16, 14, 20]\n",
    "birthday = ['1375', '1374', '1375', 'NONE' , '1376', '1373']\n",
    "married = ['yes', 'yes', 'NONE', 'no', 'NONE', 'no']\n",
    "gender = ['m', 'm', 'm', 'f', 'f', 'f']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "classroom = pd.DataFrame({\n",
    "    'name': names,\n",
    "    'gender': gender,\n",
    "    'birthday': birthday,\n",
    "    'married': married,\n",
    "    'score':score\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>gender</th>\n",
       "      <th>birthday</th>\n",
       "      <th>married</th>\n",
       "      <th>score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>ali</td>\n",
       "      <td>m</td>\n",
       "      <td>1375</td>\n",
       "      <td>yes</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>ahmad</td>\n",
       "      <td>m</td>\n",
       "      <td>1374</td>\n",
       "      <td>yes</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>akbar</td>\n",
       "      <td>m</td>\n",
       "      <td>1375</td>\n",
       "      <td>NONE</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>leila</td>\n",
       "      <td>f</td>\n",
       "      <td>NONE</td>\n",
       "      <td>no</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>maryam</td>\n",
       "      <td>f</td>\n",
       "      <td>1376</td>\n",
       "      <td>NONE</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>5</td>\n",
       "      <td>zahra</td>\n",
       "      <td>f</td>\n",
       "      <td>1373</td>\n",
       "      <td>no</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     name gender birthday married  score\n",
       "0     ali      m     1375     yes     12\n",
       "1   ahmad      m     1374     yes     15\n",
       "2   akbar      m     1375    NONE     18\n",
       "3   leila      f     NONE      no     16\n",
       "4  maryam      f     1376    NONE     14\n",
       "5   zahra      f     1373      no     20"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "classroom"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "classroom.to_csv(\"D:\\\\faradars\\\\files\\\\csv_file.csv\", encoding='utf-8',sep='\\t', index=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>gender</th>\n",
       "      <th>birthday</th>\n",
       "      <th>married</th>\n",
       "      <th>score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>ali</td>\n",
       "      <td>m</td>\n",
       "      <td>1375</td>\n",
       "      <td>yes</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>ahmad</td>\n",
       "      <td>m</td>\n",
       "      <td>1374</td>\n",
       "      <td>yes</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>akbar</td>\n",
       "      <td>m</td>\n",
       "      <td>1375</td>\n",
       "      <td>NONE</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>leila</td>\n",
       "      <td>f</td>\n",
       "      <td>NONE</td>\n",
       "      <td>no</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>maryam</td>\n",
       "      <td>f</td>\n",
       "      <td>1376</td>\n",
       "      <td>NONE</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>5</td>\n",
       "      <td>zahra</td>\n",
       "      <td>f</td>\n",
       "      <td>1373</td>\n",
       "      <td>no</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     name gender birthday married  score\n",
       "0     ali      m     1375     yes     12\n",
       "1   ahmad      m     1374     yes     15\n",
       "2   akbar      m     1375    NONE     18\n",
       "3   leila      f     NONE      no     16\n",
       "4  maryam      f     1376    NONE     14\n",
       "5   zahra      f     1373      no     20"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.read_csv(\"D:\\\\faradars\\\\files\\\\csv_file.csv\",sep='\\t', encoding='utf-8')"
   ]
  }
 ],
 "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.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
