There are several ways to do all necessary imports for using data frames with pandas.
Most people prefer this import: import pandas as pd. This imports pandas as an alias named pd. Then they can use pd.DataFrame instead of the rather verbose pandas.DataFrame they had to write if they just used import pandas.
This would be a typical code example:
import pandas as pd
data = {"a": [1, 2, 3], "b": [3, 2, 1]}
data_df = pd.DataFrame(data)
Of course you can pull DataFrame into your namespace directly. You would then go with from pandas import DataFrame. Note that python imports are case sensitive:
from pandas import DataFrame
data = {"a": [1, 2, 3], "b": [3, 2, 1]}
data_df = DataFrame(data)
Also be aware that you only have to import DataFrame if you intend to call it directly. pd.read_csv e.g. will always return a DataFrame object for you. To use it you don't have to explicitly import DataFrame first.
from pandas import DataFrame. Also note that in your snippet you do not use this import, so you could leave it out.from pandas import dataframewouldn't give youImportError: cannot import name DataFrame...