use ensure_clean rather than explicit os.remove #34384
closes #34384 
I have made a start at this issue #34384. Please let me know if I am along the right lines (beginner contributor).

I've left a space in code_checks.sh where I expect to implement the check for instances of 'os.remove' throughout the code.
This PR seems to have include all commits from a pull-request of mine which has been merged previously. Not sure why, if anybody thinks they know please let me know. Hello @jnecus! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:





There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2020-10-12 09:36:39 UTC > This PR seems to have include all commits from a pull-request of mine which has been merged previously. Not sure why, if anybody thinks they know please let me know.

It looks like you opened your pull request from `master`. It's advisable to start each new pull request from a new branch, and that (when you start working on it) that branch be synced up with `upstream master`.

See [creating a branch](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#creating-a-branch)

With how your branch is now, if you don't want your old commits, I think you'd have to do something like (assuming `upstream` is `https://github.com/pandas-dev/pandas`)
```bash
git fetch upstream master
git rebase -i upstream/master
```
and then drop the commits from your previous pull request. Once that's done, you'd have to do a forced push. Thanks @MarcoGorelli I will make sure to start a new branch next time before submitting a PR. if you can merge master. i think we may have to remove the code check for this (and just push the patches) as need os.remove in some places (though maybe can check other files and just skip the pytables ones) LGTM pending green; @jnecus can you merge master can you merge master again; also ideally would have a check for using these in code_checks.sh (but can be a followon is ok too) thanks @jnecus  @jreback Happy to do a followon code check, what are you suggesting to check for? Instances of os.remove? If so, this was tried originally (the following quote).

> i think we may have to remove the code check for this (and just push the patches) as need os.remove in some places (though maybe can check other files and just skip the pytables ones)

 yes exactly i think we don't allow os.remove except in the 1 place that we allow it now (so will have to filter the grep a bit)

iow we have a set of cases that we allow it (one for now) I've opened #37095 as a placeholder for this, @jnecus please reference it if you open a PR for this (and let us know if you want/need any help)