Convert List to Pandas Dataframe Column

前端 未结 5 1475
别跟我提以往
别跟我提以往 2020-12-02 05:34

I need to Convert my list into a one column pandas dataframe

Current List (len=3):

[\'Thanks You\',
 \'Its fine no problem\',
 \'Are you sure\']
         


        
5条回答
  •  误落风尘
    2020-12-02 06:14

    For Converting a List into Pandas Core Data Frame, we need to use DataFrame Method from pandas Package.

    There are Different Ways to Perform the Above Operation.

    import pandas as pd

    1. pd.DataFrame({'Column_Name':Column_Data})
    • Column_Name : String
    • Column_Data : List Form
    1. Data = pd.DataFrame(Column_Data)

      Data.columns = ['Column_Name']

    So, for the above mentioned issue, the code snippet is

    import pandas as pd
    
    Content = ['Thanks You',
               'Its fine no problem',
               'Are you sure']
    
    Data = pd.DataFrame({'Text': Content})
    

提交回复
热议问题