Skip to content

Commit

Permalink
refining the code
Browse files Browse the repository at this point in the history
  • Loading branch information
supriyabidanta committed Jul 26, 2024
1 parent ef35009 commit ab78908
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 50,798 deletions.
62 changes: 39 additions & 23 deletions FTU-workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "0147567f",
"metadata": {},
"outputs": [],
Expand All @@ -96,16 +96,16 @@
},
{
"cell_type": "markdown",
"id": "530a5dc6",
"id": "7fc114eb",
"metadata": {},
"source": [
"### Load Reference files"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1b567d2e",
"execution_count": 2,
"id": "2223a8f3",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -142,8 +142,8 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "ae75cab4",
"execution_count": 3,
"id": "5b490783",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -164,10 +164,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "8f7d71d7",
"metadata": {},
"outputs": [],
"execution_count": 4,
"id": "84b9e78b",
"metadata": {},
"outputs": [
{
"ename": "KeyError",
"evalue": "\"['Unnamed: 8', 'Unnamed: 9', 'Unnamed: 10', 'Unnamed: 11', 'Unnamed: 12', 'Unnamed: 13', 'Unnamed: 14'] not found in axis\"",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[4], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m ftu_cell_count \u001b[38;5;241m=\u001b[39m ftu_cell_count\u001b[38;5;241m.\u001b[39mdrop(columns\u001b[38;5;241m=\u001b[39m[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUnnamed: 6\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUnnamed: 7\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUnnamed: 8\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUnnamed: 9\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUnnamed: 10\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUnnamed: 11\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUnnamed: 12\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUnnamed: 13\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mUnnamed: 14\u001b[39m\u001b[38;5;124m'\u001b[39m], axis \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[0;32m 3\u001b[0m \u001b[38;5;66;03m# Rename 'CT ID in CL' to 'CL_ID' for consistency\u001b[39;00m\n\u001b[0;32m 4\u001b[0m ftu_cell_count \u001b[38;5;241m=\u001b[39m ftu_cell_count\u001b[38;5;241m.\u001b[39mrename(columns\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mCT ID in CL\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mCL_ID\u001b[39m\u001b[38;5;124m'\u001b[39m})\n",
"File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\pandas\\core\\frame.py:5581\u001b[0m, in \u001b[0;36mDataFrame.drop\u001b[1;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[0;32m 5433\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdrop\u001b[39m(\n\u001b[0;32m 5434\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[0;32m 5435\u001b[0m labels: IndexLabel \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 5442\u001b[0m errors: IgnoreRaise \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mraise\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 5443\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m DataFrame \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 5444\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 5445\u001b[0m \u001b[38;5;124;03m Drop specified labels from rows or columns.\u001b[39;00m\n\u001b[0;32m 5446\u001b[0m \n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 5579\u001b[0m \u001b[38;5;124;03m weight 1.0 0.8\u001b[39;00m\n\u001b[0;32m 5580\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m-> 5581\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28msuper\u001b[39m()\u001b[38;5;241m.\u001b[39mdrop(\n\u001b[0;32m 5582\u001b[0m labels\u001b[38;5;241m=\u001b[39mlabels,\n\u001b[0;32m 5583\u001b[0m axis\u001b[38;5;241m=\u001b[39maxis,\n\u001b[0;32m 5584\u001b[0m index\u001b[38;5;241m=\u001b[39mindex,\n\u001b[0;32m 5585\u001b[0m columns\u001b[38;5;241m=\u001b[39mcolumns,\n\u001b[0;32m 5586\u001b[0m level\u001b[38;5;241m=\u001b[39mlevel,\n\u001b[0;32m 5587\u001b[0m inplace\u001b[38;5;241m=\u001b[39minplace,\n\u001b[0;32m 5588\u001b[0m errors\u001b[38;5;241m=\u001b[39merrors,\n\u001b[0;32m 5589\u001b[0m )\n",
"File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\pandas\\core\\generic.py:4788\u001b[0m, in \u001b[0;36mNDFrame.drop\u001b[1;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[0;32m 4786\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m axis, labels \u001b[38;5;129;01min\u001b[39;00m axes\u001b[38;5;241m.\u001b[39mitems():\n\u001b[0;32m 4787\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m labels \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m-> 4788\u001b[0m obj \u001b[38;5;241m=\u001b[39m obj\u001b[38;5;241m.\u001b[39m_drop_axis(labels, axis, level\u001b[38;5;241m=\u001b[39mlevel, errors\u001b[38;5;241m=\u001b[39merrors)\n\u001b[0;32m 4790\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m inplace:\n\u001b[0;32m 4791\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_update_inplace(obj)\n",
"File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\pandas\\core\\generic.py:4830\u001b[0m, in \u001b[0;36mNDFrame._drop_axis\u001b[1;34m(self, labels, axis, level, errors, only_slice)\u001b[0m\n\u001b[0;32m 4828\u001b[0m new_axis \u001b[38;5;241m=\u001b[39m axis\u001b[38;5;241m.\u001b[39mdrop(labels, level\u001b[38;5;241m=\u001b[39mlevel, errors\u001b[38;5;241m=\u001b[39merrors)\n\u001b[0;32m 4829\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 4830\u001b[0m new_axis \u001b[38;5;241m=\u001b[39m axis\u001b[38;5;241m.\u001b[39mdrop(labels, errors\u001b[38;5;241m=\u001b[39merrors)\n\u001b[0;32m 4831\u001b[0m indexer \u001b[38;5;241m=\u001b[39m axis\u001b[38;5;241m.\u001b[39mget_indexer(new_axis)\n\u001b[0;32m 4833\u001b[0m \u001b[38;5;66;03m# Case for non-unique axis\u001b[39;00m\n\u001b[0;32m 4834\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
"File \u001b[1;32m~\\AppData\\Roaming\\Python\\Python311\\site-packages\\pandas\\core\\indexes\\base.py:7070\u001b[0m, in \u001b[0;36mIndex.drop\u001b[1;34m(self, labels, errors)\u001b[0m\n\u001b[0;32m 7068\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m mask\u001b[38;5;241m.\u001b[39many():\n\u001b[0;32m 7069\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m errors \u001b[38;5;241m!=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mignore\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[1;32m-> 7070\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mlabels[mask]\u001b[38;5;241m.\u001b[39mtolist()\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m not found in axis\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 7071\u001b[0m indexer \u001b[38;5;241m=\u001b[39m indexer[\u001b[38;5;241m~\u001b[39mmask]\n\u001b[0;32m 7072\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdelete(indexer)\n",
"\u001b[1;31mKeyError\u001b[0m: \"['Unnamed: 8', 'Unnamed: 9', 'Unnamed: 10', 'Unnamed: 11', 'Unnamed: 12', 'Unnamed: 13', 'Unnamed: 14'] not found in axis\""
]
}
],
"source": [
"ftu_cell_count = ftu_cell_count.drop(columns=['Unnamed: 6','Unnamed: 7','Unnamed: 8','Unnamed: 9','Unnamed: 10','Unnamed: 11','Unnamed: 12','Unnamed: 13','Unnamed: 14'], axis = False)\n",
"\n",
Expand Down Expand Up @@ -297,7 +313,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "25e954cd",
"id": "f6599e7e",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -447,7 +463,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a0917d09",
"id": "7657f392",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -747,7 +763,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "3409b6d9",
"id": "fc279e12",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -765,7 +781,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7360d58e",
"id": "8d230fe1",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -834,7 +850,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "887ce4ec",
"id": "d5c1d6a8",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -854,7 +870,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6d3814b2",
"id": "4d7c5d2b",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -937,7 +953,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "0973bbb8",
"id": "fe7735ac",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -1089,7 +1105,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a6c2dbfd",
"id": "cd6eb2b7",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -1137,7 +1153,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "fcc16556",
"id": "c7711109",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -1158,7 +1174,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5775ab44",
"id": "821f01df",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -1274,7 +1290,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5e58a80c",
"id": "49ce0df3",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -1299,7 +1315,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b0bab5e5",
"id": "5f16cfdd",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -1492,7 +1508,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "47a47733",
"id": "6089721e",
"metadata": {},
"outputs": [],
"source": []
Expand Down
33 changes: 33 additions & 0 deletions Untitled.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "3177c891",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.11.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit ab78908

Please sign in to comment.