Search code examples
pythonpandasnumpyflake8linter

Do I need to import Numpy to use Pandas?


I'm using pandas to manage some data frames.

In every tutorial I've seen so far, they import both numpy and pandas when working with pandas so I imported both.

I also recently installed flake8 linter, and its giving me the following message:

numpy as np imported but not used

Do both packages need to run together or can I delete that Numpy?


Solution

  • No, you do not need to import numpy for pandas to function properly. Most tutorials use numpy for some computations which is why it is imported. Otherwise, pandas is self sufficient.