title: How to convert a string with "," and "/n" into pandas DataFrame?
body: <p>I have this piece of code:</p>
  
  <pre><code>csvData = str(request.GET.get('csvData'))
  
  print("TYPE csvData", type(csvData))
  
  print("CSV", csvData)
  
  arr = np.array(csvData.splitlines())
  
  print("ARR", arr)
  
  print("TYPE arr", type(arr))
  </code></pre>
  
  <p>The <code>csvData</code> is a string.</p>
  
  <p>The code prints the following output:</p>
  
  <blockquote>
    <p>TYPE csvData </p>
    
    <p>CSV
    "NUM,AIRLINE_ARR_ICAO,WAKE,SIBT,SOBT,PLANNED_TURNAROUND,DISTANCE_FROM_ORIGIN,DISTANCE_TO_TARGET\n1,AEA,H,2016-01-01
    04:05:00,2016-01-01 14:10:00,605,9920.67,5776.89\n2,AEA,H,2016-01-01
    04:25:00,2016-01-01 06:30:00,125.0,10060.80,483.93\n3,AVA,H,2016-01-01
    05:05:00,2016-01-01 07:05:00,120.0,8033.86,8033.86\n4,IBE,H,2016-01-01
    05:20:00,2016-01-01 10:40:00,320.0,0.00,8507.73\n5,IBE,H,2016-01-01
    05:25:00,2016-01-01 10:50:00,325.0,6698.42,6698.42\n6,IBE,H,2016-01-01
    05:30:00,2016-01-01
    08:10:00,160.0,10699.06,1246.30\n7,IBE,H,2016-01-01
    05:30:00,2016-01-01 11:00:00,330.0,9081.35,8033.86\n8,IBE,H,2016-01-01
    05:40:00,2016-01-01 11:35:00,355.0,5776.89,8749.87\n9,ANE,M,2016-01-01
    05:50:00,2016-01-01 14:50:00,540.0,284.73,284.73\n10,ETD,H,2016-01-01
    06:35:00,2016-01-01 08:00:00,85.0,5647.10,5647.10\n11,IBS,M,2016-01-01
    06:50:00,2016-01-01 08:00:00,70.0,547.36,1460.92\n12,IBE,H,2016-01-01
    06:50:00,2016-01-01
    10:35:00,225.0,6763.16,6763.16\n13,IBE,H,2016-01-01
    06:50:00,2016-01-01
    10:50:00,240.0,7120.40,7120.40\n14,IBE,H,2016-01-01
    06:50:00,2016-01-01 10:55:00,245.0,7010.08,0.00\n15,QTR,H,2016-01-01
    06:55:00,2016-01-01 08:30:00,95.0,5338.52,5338.52\n16,IBS,M,2016-01-01
    07:00:00,2016-01-01 07:45:00,45.0,485.52,1721.09\n17,IBS,M,2016-01-01
    07:00:00,2016-01-01 07:45:00,45.0,394.98,429.37\n18,ELY,M,2016-01-01
    07:05:00,2016-01-01 08:30:00,85.0,3550.48,3550.48\n19,AAL,H,2016-01-01
    07:05:00,2016-01-01
    12:05:00,300.0,5925.61,5925.61\n20,TVF,M,2016-01-01
    07:30:00,2016-01-01 08:10:00,40.0,1030.31,1030.31\n"</p>
    
    <p>ARR
    ['"NUM,AIRLINE_ARR_ICAO,WAKE,SIBT,SOBT,PLANNED_TURNAROUND,DISTANCE_FROM_ORIGIN,DISTANCE_TO_TARGET\n1,AEA,H,2016-01-01
    04:05:00,2016-01-01 14:10:00,605,9920.67,5776.89\n2,AEA,H,2016-01-01
    04:25:00,2016-01-01
    06:30:00,125.0,10060.80,483.93\n3,AVA,H,2016-01-01
    05:05:00,2016-01-01
    07:05:00,120.0,8033.86,8033.86\n4,IBE,H,2016-01-01
    05:20:00,2016-01-01 10:40:00,320.0,0.00,8507.73\n5,IBE,H,2016-01-01
    05:25:00,2016-01-01
    10:50:00,325.0,6698.42,6698.42\n6,IBE,H,2016-01-01
    05:30:00,2016-01-01
    08:10:00,160.0,10699.06,1246.30\n7,IBE,H,2016-01-01
    05:30:00,2016-01-01
    11:00:00,330.0,9081.35,8033.86\n8,IBE,H,2016-01-01
    05:40:00,2016-01-01
    11:35:00,355.0,5776.89,8749.87\n9,ANE,M,2016-01-01
    05:50:00,2016-01-01 14:50:00,540.0,284.73,284.73\n10,ETD,H,2016-01-01
    06:35:00,2016-01-01
    08:00:00,85.0,5647.10,5647.10\n11,IBS,M,2016-01-01
    06:50:00,2016-01-01 08:00:00,70.0,547.36,1460.92\n12,IBE,H,2016-01-01
    06:50:00,2016-01-01
    10:35:00,225.0,6763.16,6763.16\n13,IBE,H,2016-01-01
    06:50:00,2016-01-01
    10:50:00,240.0,7120.40,7120.40\n14,IBE,H,2016-01-01
    06:50:00,2016-01-01 10:55:00,245.0,7010.08,0.00\n15,QTR,H,2016-01-01
    06:55:00,2016-01-01
    08:30:00,95.0,5338.52,5338.52\n16,IBS,M,2016-01-01
    07:00:00,2016-01-01 07:45:00,45.0,485.52,1721.09\n17,IBS,M,2016-01-01
    07:00:00,2016-01-01 07:45:00,45.0,394.98,429.37\n18,ELY,M,2016-01-01
    07:05:00,2016-01-01
    08:30:00,85.0,3550.48,3550.48\n19,AAL,H,2016-01-01
    07:05:00,2016-01-01
    12:05:00,300.0,5925.61,5925.61\n20,TVF,M,2016-01-01
    07:30:00,2016-01-01 08:10:00,40.0,1030.31,1030.31\n"']</p>
    
    <p>TYPE arr </p>
  </blockquote>
  
  <p>I need to convert <code>arr</code> to pandas DataFrame. I wrote this code:</p>
  
  <pre><code>new = []
  for i in range(0,len(arr)):
      line = arr[i].split(",")
      new.append(line)
  
  X = pd.DataFrame(new[1:],columns=new[0])
  
  print("X",X.head())
  </code></pre>
  
  <p>But it does not work properly. I assume that it does not work because <code>arr</code>  is <code>['".."']</code> instead of <code>[..]</code>.</p>
  
  <p>Any help is highly appreciated.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <pre><code>csvData = pd.read_csv(io.StringIO((request.GET.get('csvData'))))
  
  print("TYPE csvData", type(csvData))
  
  print("CSV", csvData.head())
  
  TYPE csvData &lt;class 'pandas.core.frame.DataFrame' CSV Empty DataFrame
  Columns:
  [NUM,AIRLINE_ARR_ICAO,WAKE,SIBT,SOBT,PLANNED_TURNAROUND,DISTANCE_FROM_ORIGIN,DISTANCE_TO_TARGET\n1,AEA,H,2016-01-01
  04:05:00,2016-01-01 14:10:00,605,9920.67,5776.89\n2,AEA,H,2016-01-01
  04:25:00,2016-01-01 06:30:00,125.0,10060.80,483.93\n3,AVA,H,2016-01-01
  05:05:00,2016-01-01 07:05:00,120.0,8033.86,8033.86\n4,IBE,H,2016-01-01
  05:20:00,2016-01-01 10:40:00,320.0,0.00,8507.73\n5,IBE,H,2016-01-01
  05:25:00,2016-01-01 10:50:00,325.0,6698.42,6698.42\n6,IBE,H,2016-01-01
  05:30:00,2016-01-01
  08:10:00,160.0,10699.06,1246.30\n7,IBE,H,2016-01-01
  05:30:00,2016-01-01 11:00:00,330.0,9081.35,8033.86\n8,IBE,H,2016-01-01
  05:40:00,2016-01-01 11:35:00,355.0,5776.89,8749.87\n9,ANE,M,2016-01-01
  05:50:00,2016-01-01 14:50:00,540.0,284.73,284.73\n10,ETD,H,2016-01-01
  06:35:00,2016-01-01 08:00:00,85.0,5647.10,5647.10\n11,IBS,M,2016-01-01
  06:50:00,2016-01-01 08:00:00,70.0,547.36,1460.92\n12,IBE,H,2016-01-01
  06:50:00,2016-01-01
  10:35:00,225.0,6763.16,6763.16\n13,IBE,H,2016-01-01
  06:50:00,2016-01-01
  10:50:00,240.0,7120.40,7120.40\n14,IBE,H,2016-01-01
  06:50:00,2016-01-01 10:55:00,245.0,7010.08,0.00\n15,QTR,H,2016-01-01
  06:55:00,2016-01-01 08:30:00,95.0,5338.52,5338.52\n16,IBS,M,2016-01-01
  07:00:00,2016-01-01 07:45:00,45.0,485.52,1721.09\n17,IBS,M,2016-01-01
  07:00:00,2016-01-01 07:45:00,45.0,394.98,429.37\n18,ELY,M,2016-01-01
  07:05:00,2016-01-01 08:30:00,85.0,3550.48,3550.48\n19,AAL,H,2016-01-01
  07:05:00,2016-01-01
  12:05:00,300.0,5925.61,5925.61\n20,TVF,M,2016-01-01
  07:30:00,2016-01-01 08:10:00,40.0,1030.31,1030.31\n] 
  
  Index: []
  </code></pre>
  
  <p><strong>Update 2:</strong></p>
  
  <pre><code>csvData = pd.read_csv(io.StringIO((request.GET.get('csvData').replace('\\n', '\n'))))
  
  print("TYPE csvData", type(csvData))
  
  print("CSV", csvData.head())
  
  TYPE csvData &lt;class 'pandas.core.frame.DataFrame'&gt;
  CSV Empty DataFrame
  
  Columns: [NUM,AIRLINE_ARR_ICAO,WAKE,SIBT,SOBT,PLANNED_TURNAROUND,DISTANCE_FROM_ORIGIN,DISTANCE_TO_TARGET
  1,AEA,H,2016-01-01 04:05:00,2016-01-01 14:10:00,605,9920.67,5776.89
  2,AEA,H,2016-01-01 04:25:00,2016-01-01 06:30:00,125.0,10060.80,483.93
  3,AVA,H,2016-01-01 05:05:00,2016-01-01 07:05:00,120.0,8033.86,8033.86
  4,IBE,H,2016-01-01 05:20:00,2016-01-01 10:40:00,320.0,0.00,8507.73
  5,IBE,H,2016-01-01 05:25:00,2016-01-01 10:50:00,325.0,6698.42,6698.42
  6,IBE,H,2016-01-01 05:30:00,2016-01-01 08:10:00,160.0,10699.06,1246.30
  7,IBE,H,2016-01-01 05:30:00,2016-01-01 11:00:00,330.0,9081.35,8033.86
  8,IBE,H,2016-01-01 05:40:00,2016-01-01 11:35:00,355.0,5776.89,8749.87
  9,ANE,M,2016-01-01 05:50:00,2016-01-01 14:50:00,540.0,284.73,284.73
  10,ETD,H,2016-01-01 06:35:00,2016-01-01 08:00:00,85.0,5647.10,5647.10
  11,IBS,M,2016-01-01 06:50:00,2016-01-01 08:00:00,70.0,547.36,1460.92
  12,IBE,H,2016-01-01 06:50:00,2016-01-01 10:35:00,225.0,6763.16,6763.16
  13,IBE,H,2016-01-01 06:50:00,2016-01-01 10:50:00,240.0,7120.40,7120.40
  14,IBE,H,2016-01-01 06:50:00,2016-01-01 10:55:00,245.0,7010.08,0.00
  15,QTR,H,2016-01-01 06:55:00,2016-01-01 08:30:00,95.0,5338.52,5338.52
  16,IBS,M,2016-01-01 07:00:00,2016-01-01 07:45:00,45.0,485.52,1721.09
  17,IBS,M,2016-01-01 07:00:00,2016-01-01 07:45:00,45.0,394.98,429.37
  18,ELY,M,2016-01-01 07:05:00,2016-01-01 08:30:00,85.0,3550.48,3550.48
  19,AAL,H,2016-01-01 07:05:00,2016-01-01 12:05:00,300.0,5925.61,5925.61
  20,TVF,M,2016-01-01 07:30:00,2016-01-01 08:10:00,40.0,1030.31,1030.31
  ]
  
  Index: []
  </code></pre>
  
  <p><strong>Update 3:</strong></p>
  
  <p>This is how <code>csvData</code> is generated,</p>
  
  <pre><code>    var reader = new FileReader();
      reader.onload =  (e) =&gt; {
        // Use reader.result
        this.setState({
          csvData: reader.result
        })
        this.props.setCsvData(reader.result)
      }
      reader.readAsText(files[0])
  </code></pre>
  
  <p>Then I sent it to backend in this way:</p>
  
  <pre><code>'&amp;csvData='+JSON.stringify(this.state.csvData)
  </code></pre>