Assume you have a pandas
dataframe df
that has the column foo
. Then, in Jupyter
when you type df.fo<TAB>
the column name will be completed.
This works when df
is in memory.
However, if df
is not in memory then you can’t TAB complete the column name.
Is there a way to TAB complete the column name in an IDE when df
is not in memory?
More specifically, assume that I develop a function. I can give type hint to df
so when inside the function I can get completions related to pandas
.
import pandas as pd
def my_function(foo: pd.DataFrame, bar: pd.DataFrame):
foo.joi<TAB>
Here, foo.join
will be completed and in general I can see the available methods for foo
.
My question is, what about the columns of the dataframe (and their types)? Is there a way to get completions for the columns of the dataframe when df
is not in memory? I have in mind something like type hinting that hints the IDE about the columns of the dataframe.
Similarly, to how you can hint a dictionary with Dict[str, Dict[int: str]]
and then you get completions for the keys of the dictionary.
A bonus question is, how can this be done with PySpark
dataframes?