I have a Notebook which I call it as Template . I need to pass a variable called ID = 'EF12345'(string value) as an argument based on which my notebook will run and create a new notebook
These are few posts which I referred , I am missing something where I am not to figure out Argparse in Jupyter Notebook throws a TypeError
I cannot do pip install (blocked -- no internet)
Passing command line arguments to argv in jupyter/ipython notebook
Original Code cold_mill_id = 'E126644'
strip_stats = hive_ctx.sql(query).toPandas()
strip_stats[strip_stats.cold_mill_id == cold_mill_id]
sns.set(font_scale=1.2, font='DejaVu Sans')
fig, ax = plt.subplots(1, 1, figsize=(15, 6))
xp = df.position
yp = df.fm_entry_temperature
p = ax.plot(xp, yp, linestyle='-', label='fm_entry_temperature')
yp = df.fm_exit_temperature
p = ax.plot(xp, yp, linestyle='-', label='fm_exit_temperature')
p = ax.set_title('finishing mill temperature profiles for cold_mill_id=' +
cold_mill_id)
p = ax.set_xlabel('position')
p = ax.set_ylabel('temperature (F)')
p = ax.set_ylim(1650, 2100)
p = plt.legend()
I added argparse to get value for my cold mill id
parser.add_argument('--id')
args = parser.parse_args([])
args, cold_mill_id = parser.parse_known_args()
ID which I am passing is not working , I am not able to pass ID - which is string and then my code sucks This is how I need
nbconvert --to notebook --execute Template.ipynb 'E12664'
ID which I am passing from Parser is not working , neither can I debug from Command line what is happening fails at certain point in execution when TYPE of ID mismatches with what is expected
Added this piece of code after argparse to check what is getting inside but won't print it in command line
import sys
print(sys.argv)
I am doing something horribly wrong I am clueless What I need is I need to somehow pass this ID to cold_mill_id in jupyter notebook and save those results for new ID as one more notebook