0

How to create a Dataframe from a list of variables corresponding to its value.

A = 10
B = 15
df = [A,B]

Output = [output]

1

starkt964
  • 1
  • 3
  • 1
    See [this question and answers for the difficulties in trying to access the name of a variable in python](https://stackoverflow.com/questions/18425225/getting-the-name-of-a-variable-as-a-string). If you control how the variables are being assigned in the first place, then save them in a dict instead (`{'a':10,'b':5}`) as those play nice with pandas. If not, then weigh the time investment in implementing one of the related answers vs just retyping the entries for `col1` – G. Anderson May 02 '22 at 23:15

0 Answers0