Skip to content

Commit

Permalink
picklist tiny update
Browse files Browse the repository at this point in the history
  • Loading branch information
klinga committed Sep 24, 2024
1 parent 7a26bec commit b555b7f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
46 changes: 23 additions & 23 deletions google_books/picklist-draft.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 57,
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -13,7 +13,7 @@
},
{
"cell_type": "code",
"execution_count": 58,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -31,7 +31,7 @@
},
{
"cell_type": "code",
"execution_count": 59,
"execution_count": 19,
"metadata": {},
"outputs": [
{
Expand All @@ -48,7 +48,7 @@
},
{
"cell_type": "code",
"execution_count": 60,
"execution_count": 20,
"metadata": {},
"outputs": [
{
Expand All @@ -65,7 +65,7 @@
},
{
"cell_type": "code",
"execution_count": 61,
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -88,20 +88,20 @@
},
{
"cell_type": "code",
"execution_count": 62,
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"def do_not_sent(row):\n",
" if not row[\"iLocation\"].startswith((\"bu\", \"ma\", \"pa\", \"rc\", \"sc\")):\n",
" if not row[\"iLocation\"].startswith((\"bu\", \"ma\", \"pa\", \"rc\", \"sc\", \"ls\")):\n",
" return \"TRUE\"\n",
" elif int(row[\"iType\"]) > 101:\n",
" return \"TRUE\"\n",
" elif int(row[\"iType\"]) in (\n",
" 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,\n",
" 21, 22, 23, 24, 26, 27, 28, 30, 31, 32, 33, 34,\n",
" 35, 36, 37, 38, 39, 41, 42, 43, 51, 52, 53, 66, 68, 70, 72,\n",
" 73, 74, 75, 76, 79, 51, 52, 53):\n",
" 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,\n",
" 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,\n",
" 35, 36, 37, 38, 39, 41, 42, 43, 50, 51, 52, 53, 61, 66, 68, 70, 72,\n",
" 73, 74, 75, 76, 79):\n",
" return \"TRUE\"\n",
" elif \"google\" in row[\"iIntNote\"].lower():\n",
" return \"TRUE\"\n",
Expand All @@ -114,7 +114,7 @@
},
{
"cell_type": "code",
"execution_count": 63,
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -123,7 +123,7 @@
},
{
"cell_type": "code",
"execution_count": 64,
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -132,18 +132,18 @@
},
{
"cell_type": "code",
"execution_count": 65,
"execution_count": 35,
"metadata": {},
"outputs": [],
"source": [
"df_sasb = df[(df[\"building\"] == \"SASB\") & (df[\"do_not_sent\"] == \"FALSE\")]\n",
"gdf_sasb = df_sasb.groupby(\"iLocation\")[[\"iNumber\", \"iLocation\", \"iBarcode\", \"iCallNum\", \"title\", \"pubInfo\", \"bCallNum\", \"bStaffCallNum\"]].apply(lambda x: x.sort_values(\"iCallNum\"))\n",
"gdf_sasb.to_csv(\"../files/picklist/sasb.csv\", index=False, sep=\"\\t\", columns=[\"iNumber\", \"iLocation\", \"iBarcode\", \"iCallNum\", \"title\", \"pubInfo\", \"bCallNum\", \"bStaffCallNum\"])"
"gdf_sasb = df_sasb.groupby(\"iLocation\")[[\"iNumber\", \"iLocation\", \"iBarcode\", \"iCallNum\", \"iVolume\", \"title\", \"pubInfo\", \"bCallNum\", \"bStaffCallNum\"]].apply(lambda x: x.sort_values(\"iCallNum\"))\n",
"gdf_sasb.to_csv(\"../files/picklist/sasb.csv\", index=False, sep=\"\\t\", columns=[\"iNumber\", \"iLocation\", \"iBarcode\", \"iCallNum\", \"iVolume\", \"title\", \"pubInfo\", \"bCallNum\", \"bStaffCallNum\"])"
]
},
{
"cell_type": "code",
"execution_count": 66,
"execution_count": 27,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -154,7 +154,7 @@
},
{
"cell_type": "code",
"execution_count": 67,
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -165,7 +165,7 @@
},
{
"cell_type": "code",
"execution_count": 68,
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -175,7 +175,7 @@
},
{
"cell_type": "code",
"execution_count": 69,
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -186,7 +186,7 @@
},
{
"cell_type": "code",
"execution_count": 70,
"execution_count": 31,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -197,7 +197,7 @@
},
{
"cell_type": "code",
"execution_count": 71,
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -208,7 +208,7 @@
},
{
"cell_type": "code",
"execution_count": 72,
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
Expand Down
3 changes: 2 additions & 1 deletion google_books/picklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def prep_item_list_for_sierra(tar_file: str, list_size: int) -> None:
files = glob.glob("files/picklist/*_combined-*.txt")
n = -1
s = 1
print(f"Outputting to file: {str(s).zfill(3)}...")
for f in files:
reader = csv.reader(open(f, "r", encoding="utf-8"), delimiter="\t")
for row in reader:
Expand All @@ -60,7 +61,7 @@ def prep_sierra_export_for_dataframe(fh: str, date: str) -> None:
Args:
fh (str): The path to the Sierra export file
date (str): The date of the export in the fomrmat YYYY-MM-DD
date (str): The date of the export in the format YYYY-MM-DD
"""
with open(fh, "r", encoding="utf-8", errors="replace") as f:
reader = csv.reader(f, delimiter="\t")
Expand Down

0 comments on commit b555b7f

Please sign in to comment.