Run code automatically
hanan lamaazi
hanan.lamaazi at gmail.com
Mon Apr 20 07:28:08 EDT 2020
Yes I try to do it but it doesn't work for two reasons:
I write my code as blocks in jupyter notebook and for each block I use
different datasets that I loc, iloc or concat according to my need.
for this reasons I export it as .py file to run it externally
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Garanti
sans virus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Le lun. 20 avr. 2020 à 12:44, Souvik Dutta <souvik.viksou at gmail.com> a
écrit :
> No no I did not tell you to do it in that way. I said you could try
> putting the whole the code in the .py file in a for loop. That is:-
> for a in range(10):
> <all the code in the file>
>
> On Mon, 20 Apr, 2020, 1:55 pm hanan lamaazi, <hanan.lamaazi at gmail.com>
> wrote:
>
>> Yes, so to do it I save my code as filename.ipynb and go to terminal
>> (cmd) I write the following commande:
>>
>> >> run for x in {1..10}; do (ipython filename.ipynb > /tmp/$x.log) & done
>>
>> it gives the following error:
>>
>> ERROR: root:File ''for.py'' not found
>>
>>
>> I use another one:
>>
>> >> for filename in $(find $Foldername -name *.py)
>> .....:do
>> .......: python $filename
>> .......:done
>>
>> It gives the following error/
>>
>> File "<ipython-input-7-fda0e2169aa3>", line 1
>> for filename in $(find $foldername -name *.py)
>>
>> SyntaxError: invalid syntax
>>
>>
>> Could please suggest me any other solution? or what is wrong with those
>> expressions?
>>
>> Thank you
>>
>>
>> Le jeu. 16 avr. 2020 à 16:57, Souvik Dutta <souvik.viksou at gmail.com> a
>> écrit :
>>
>>> Do you want to run the code many times after just clicking run once? If
>>> so then I think grouping the whole program in one for loop would do the
>>> task.
>>>
>>> Souvik python dev
>>>
>>> On Thu, Apr 16, 2020, 4:57 PM hanan lamaazi <hanan.lamaazi at gmail.com>
>>> wrote:
>>>
>>>> Dear All,
>>>>
>>>> I just start the self learning of python, and I tried to use it in
>>>> jupyter
>>>> notebook. I work on real dataset and I used pandas for that. Now my
>>>> problem
>>>> is I developed two separate code but dependent the first one should run
>>>> to
>>>> give me samples from my dataset and do the clustering (I use Kmeans)
>>>> and
>>>> the second should select data from each cluster provided by the first
>>>> code.
>>>>
>>>> My question is:
>>>> how can I run both code for many times without pushing the bottom "run"
>>>> each time? make it automatic
>>>>
>>>>
>>>> I tried to use Ipyparallel but seems that I don't know how to use it
>>>>
>>>>
>>>> Thank you
>>>> --
>>>> https://mail.python.org/mailman/listinfo/python-list
>>>>
>>>
More information about the Python-list
mailing list