FileNotFoundError                         Traceback (most recent call last)
File ~\AppData\Local\Programs\Python\Python39\lib\shutil.py:806, in move(src, dst, copy_function)
805 try:
 → 806     os.rename(src, real_dst)
807 except OSError:
FileNotFoundError: [WinError 3] The system cannot find the path specified: ‘dataset pascal voc\2007_000027.jpg’ → ‘train\2007_000027.jpg’
During handling of the above exception, another exception occurred:
FileNotFoundError                         Traceback (most recent call last)
Cell In[73], line 1
----> 1 filename_series.head(2).apply(save_data,args=(train_folder,groupby_obj_train))
File c:\users\lenovo\desktop\internship\yolo\yolo_venv\lib\site-packages\pandas\core\series.py:4917, in Series.apply(self, func, convert_dtype, args, by_row, **kwargs)
4789 def apply(
4790     self,
4791     func: AggFuncType,
(…)
4796     **kwargs,
4797 ) → DataFrame | Series:
4798     “”"
4799     Invoke function on values of Series.
4800
(…)
4915     dtype: float64
4916     “”"
 → 4917     return SeriesApply(
4918         self,
4919         func,
4920         convert_dtype=convert_dtype,
4921         by_row=by_row,
4922         args=args,
4923         kwargs=kwargs,
4924     ).apply()
File c:\users\lenovo\desktop\internship\yolo\yolo_venv\lib\site-packages\pandas\core\apply.py:1427, in SeriesApply.apply(self)
1424     return self.apply_compat()
1426 # self.func is Callable
 → 1427 return self.apply_standard()
File c:\users\lenovo\desktop\internship\yolo\yolo_venv\lib\site-packages\pandas\core\apply.py:1507, in SeriesApply.apply_standard(self)
1501 # row-wise access
1502 # apply doesn’t have a na_action keyword and for backward compat reasons
1503 # we need to give na_action="ignore" for categorical data.
1504 # TODO: remove the na_action="ignore" when that default has been changed in
1505 #  Categorical (GH51645).
1506 action = “ignore” if isinstance(obj.dtype, CategoricalDtype) else None
 → 1507 mapped = obj._map_values(
1508     mapper=curried, na_action=action, convert=self.convert_dtype
1509 )
1511 if len(mapped) and isinstance(mapped[0], ABCSeries):
1512     # GH#43986 Need to do list(mapped) in order to get treated as nested
1513     #  See also GH#25959 regarding EA support
1514     return obj._constructor_expanddim(list(mapped), index=obj.index)
File c:\users\lenovo\desktop\internship\yolo\yolo_venv\lib\site-packages\pandas\core\base.py:921, in IndexOpsMixin._map_values(self, mapper, na_action, convert)
918 if isinstance(arr, ExtensionArray):
919     return arr.map(mapper, na_action=na_action)
 → 921 return algorithms.map_array(arr, mapper, na_action=na_action, convert=convert)
File c:\users\lenovo\desktop\internship\yolo\yolo_venv\lib\site-packages\pandas\core\algorithms.py:1743, in map_array(arr, mapper, na_action, convert)
1741 values = arr.astype(object, copy=False)
1742 if na_action is None:
 → 1743     return lib.map_infer(values, mapper, convert=convert)
1744 else:
1745     return lib.map_infer_mask(
1746         values, mapper, mask=isna(values).view(np.uint8), convert=convert
1747     )
File lib.pyx:2972, in pandas._libs.lib.map_infer()
File c:\users\lenovo\desktop\internship\yolo\yolo_venv\lib\site-packages\pandas\core\apply.py:1496, in SeriesApply.apply_standard..curried(x)
1495 def curried(x):
 → 1496     return func(x, *self.args, **self.kwargs)
Cell In[71], line 7, in save_data(filename, folder_path, group_obj)
5 src=os.path.join(‘dataset pascal voc’,filename)
6 dst=os.path.join(‘train’,filename)
----> 7 move(src,dst)#move images to the destination folder
8 #save the labels,txt filename should be same
10 text_filename =os.path.join(folder_path,
11                             os.path.splitext(filename)[0]+‘.txt’)
File ~\AppData\Local\Programs\Python\Python39\lib\shutil.py:826, in move(src, dst, copy_function)
824         rmtree(src)
825     else:
 → 826         copy_function(src, real_dst)
827         os.unlink(src)
828 return real_dst
File ~\AppData\Local\Programs\Python\Python39\lib\shutil.py:435, in copy2(src, dst, follow_symlinks)
433 if os.path.isdir(dst):
434     dst = os.path.join(dst, os.path.basename(src))
 → 435 copyfile(src, dst, follow_symlinks=follow_symlinks)
436 copystat(src, dst, follow_symlinks=follow_symlinks)
437 return dst
File ~\AppData\Local\Programs\Python\Python39\lib\shutil.py:264, in copyfile(src, dst, follow_symlinks)
262     os.symlink(os.readlink(src), dst)
263 else:
 → 264     with open(src, ‘rb’) as fsrc, open(dst, ‘wb’) as fdst:
265         # macOS
266         if _HAS_FCOPYFILE:
267             try:
FileNotFoundError: [Errno 2] No such file or directory: ‘train\2007_000027.jpg’
filename_series.head(2).apply(save_data,args=(train_folder,groupby_obj_train))
jupyter notebook
python 3.9


