0

I have create an empty dataframe as:

df = pd.DataFrame(columns=["steps","amount","token_id"])

Now I want to add index to it. The index is not readily defined, but are going to set by the program in run time. I tried the following:

df.index = ["new1"]

But got error. I want to know how an empty dataframe can be set with the new index.
I want the outcome be like the following:

         amount steps token_id
new1    NaN      NaN      NaN

Please let me know how is this possible.

Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139

0 Answers0