Python lists to Dataset

Hello Everyone,
I have the python list as shown below,
I want to convert that into dataset so that I can draw the chart. Note, that every element in list has 2 values separated by comma. So the first value would be my X plot and another would be Y.

['9.4,-104.55', '10,-89.09', '10.6,-74.55', '11.2,-62.73', '11.8,-50.00', '12.4,-37.27', '13,-20.91', '13.6,-7.27', '14.2,7.27', '14.8,20.91', '15.4,41.82', '16,58.18', '16.6,78.18', '17.2,100.00', '17.8,121.82', '18.4,141.82', '19,158.18', '19.6,174.55', '20.2,184.55', '20.8,193.21', '21.4,198.08', '22,203.66', '22.6,208.94', '23.2,213.01', '23.7,215.82', '24.3,217.35', '24.9,217.59', '25.5,216.56', '26.1,218.91', '26.7,219.09', '27.3,219.09', '27.9,217.27', '28.5,213.64', '29.1,213.64', '29.7,217.27', '30.3,219.09', '30.9,219.09', '31.5,217.27', '32.1,213.64', '32.7,218.18', '33.3,220.91', '33.9,221.82', '34.5,220.91', '35.1,218.18', '35.7,218.18', '36.3,220.91', '36.9,221.82', '37.5,220.91', '38.1,222.73', '38.7,221.82', '39.3,223.64', '39.9,223.64', '40.5,223.53', '41.1,225.77', '41.7,224.94', '42.3,226.59', '42.9,230.68', '43.4,231.62', '44,229.39', '44.6,234.26', '45.2,235.92', '45.8,234.46', '46.4,234.55', '47,232.73', '47.6,232.73', '48.2,234.55', '48.8,232.73', '49.4,232.73', '50,234.55', '50.6,232.73', '51.2,237.27', '51.8,238.18', '52.4,235.45', '53,239.09', '53.6,239.09', '54.2,240.00', '54.8,241.82', '55.4,244.55', '56,242.73', '56.6,246.36', '57.2,245.45', '57.8,250.00', '58.4,250.00', '59,250.00', '59.6,250.00', '60.2,250.00', '60.8,250.00', '61.4,250.00', '62,250.00', '62.6,250.00', '63.2,251.90', '63.8,253.40', '64.4,259.20', '65,259.08', '65.6,263.23', '66.1,266.04', '66.7,267.48', '67.3,267.59', '67.9,270.96', '68.5,267.48', '69.1,267.27', '69.7,267.27', '70.3,270.00', '70.9,275.45', '71.5,273.64', '72.1,274.55', '72.7,278.18', '73.3,279.09', '73.9,281.82', '74.5,286.36', '75.1,287.27', '75.7,289.09', '76.3,291.82', '76.9,295.45', '77.5,300.00', '78.1,300.00', '78.7,300.00', '79.3,300.00', '79.9,300.00', '80.5,300.00', '81.1,300.00', '81.7,300.00', '82.3,300.00', '82.9,304.55', '83.5,310.42', '84.1,315.06', '84.7,318.39', '85.3,320.33', '85.9,320.84', '86.4,319.90', '87,317.52', '87.6,318.41', '88.2,316.97', '88.8,313.27', '89.4,312.73', '90,313.64', '90.6,313.64', '91.2,312.73', '91.8,310.91', '92.4,308.18', '93,304.55', '93.6,300.00', '94.2,300.00', '94.8,300.00', '95.4,300.00', '96,300.00', '96.6,300.00', '97.2,300.00', '97.8,300.00', '98.4,295.45', '99,291.82', '99.6,289.09', '100.2,287.27', '100.8,286.36', '101.4,286.36', '102,282.73', '102.6,280.91', '103.2,280.91', '103.8,278.18', '104.4,278.18', '105,275.45', '105.6,270.00', '106.2,269.27', '106.8,266.33', '107.4,266.63', '108,265.62', '108.6,263.22', '109.1,259.47', '109.7,260.00', '110.3,254.54', '110.9,253.39', '111.5,251.83', '112.1,245.45', '112.7,246.36', '113.3,242.73', '113.9,240.00', '114.5,238.18', '115.1,237.27', '115.7,232.73', '116.3,230.00', '116.9,224.55', '117.5,226.36', '118.1,225.45', '118.7,221.82', '119.3,220.91', '119.9,218.18', '120.5,213.64', '121.1,212.73', '121.7,210.91', '122.3,208.18', '122.9,204.55', '123.5,200.00', '124.1,195.45', '124.7,191.82', '125.3,189.09', '125.9,187.27', '126.5,186.36', '127.1,186.36', '127.7,182.73', '128.3,180.91', '128.9,180.91', '129.5,178.18', '130.1,178.18', '130.7,175.45', '131.3,170.00', '131.9,167.27', '132.5,167.27', '133.1,165.45', '133.7,167.27', '134.3,162.73', '134.9,161.82', '135.5,160.00', '136.1,157.27', '136.7,153.64', '137.3,154.55', '137.9,150.00', '138.5,145.45', '139.1,146.36', '139.7,142.73', '140.3,144.55', '140.9,141.82', '141.5,140.00', '142.1,139.09', '142.7,139.09', '143.3,135.45', '143.9,133.64', '144.5,133.64', '145.1,130.00', '145.7,128.18', '146.3,123.64', '146.9,126.36', '147.5,126.36', '148.1,123.64', '148.7,123.64', '149.3,121.82', '149.9,118.18', '150.5,112.73', '151.1,110.91', '151.7,108.18', '152.3,109.09', '152.9,108.18', '153.5,110.91', '154.1,112.73', '154.7,113.64', '155.3,113.64', '155.9,112.73', '156.5,110.91', '157.1,108.18', '157.7,100.00', '158.3,92.57', '158.9,90.38', '159.5,88.93', '160.1,88.26', '160.7,88.39', '161.2,89.33', '161.8,91.06', '162.4,93.57', '163,92.17', '163.6,92.47', '164.2,89.09', '164.8,87.27', '165.4,86.36', '166,81.82', '166.6,79.09', '167.2,78.18', '167.8,79.09', '168.4,77.27', '169,78.18', '169.6,76.36', '170.2,76.36', '170.8,73.64', '171.4,73.64', '172,76.36', '172.6,71.82', '173.2,70.00', '173.8,70.91', '174.4,70.00', '175,67.27', '175.6,62.73', '176.2,61.82', '176.8,64.55', '177.4,60.91', '180.4,63.93', '180.4,63.93']
 Pressure Rate Curve

I have tried,

ds = system.dataset.toDataSet(['Column name'], Curve1data)

But, it gives me an error as,

Traceback (most recent call last):

  File "<event:propertyChange>", line 133, in <module>

  File "<event:propertyChange>", line 18, in ReadFile

  File "<event:propertyChange>", line 127, in CheckData

IndexError: Row 0 doesn't have the same number of columns as header list.



Ignition v7.8.5 (b2016120813)
Java: Oracle Corporation 1.8.0_131

Suggestion appreciated.
Thanks.

toDataSet() needs its rows in the form of a list of lists. Each inner list becomes a row, and must have the same number of items as the list of column names.

What Phil said ^

Not sure where your list came from but the best thing to do is groom it into a list of lists there. You will also have trouble using the strings in a chart so will need to convert them to floats. This works:

myList = ['9.4,-104.55', '10,-89.09', '10.6,-74.55', '11.2,-62.73', '11.8,-50.00', '12.4,-37.27', '13,-20.91', '13.6,-7.27', '14.2,7.27', '14.8,20.91', '15.4,41.82', '16,58.18', '16.6,78.18', '17.2,100.00', '17.8,121.82', '18.4,141.82', '19,158.18', '19.6,174.55', '20.2,184.55', '20.8,193.21', '21.4,198.08', '22,203.66', '22.6,208.94', '23.2,213.01', '23.7,215.82', '24.3,217.35', '24.9,217.59', '25.5,216.56', '26.1,218.91', '26.7,219.09', '27.3,219.09', '27.9,217.27', '28.5,213.64', '29.1,213.64', '29.7,217.27', '30.3,219.09', '30.9,219.09', '31.5,217.27', '32.1,213.64', '32.7,218.18', '33.3,220.91', '33.9,221.82', '34.5,220.91', '35.1,218.18', '35.7,218.18', '36.3,220.91', '36.9,221.82', '37.5,220.91', '38.1,222.73', '38.7,221.82', '39.3,223.64', '39.9,223.64', '40.5,223.53', '41.1,225.77', '41.7,224.94', '42.3,226.59', '42.9,230.68', '43.4,231.62', '44,229.39', '44.6,234.26', '45.2,235.92', '45.8,234.46', '46.4,234.55', '47,232.73', '47.6,232.73', '48.2,234.55', '48.8,232.73', '49.4,232.73', '50,234.55', '50.6,232.73', '51.2,237.27', '51.8,238.18', '52.4,235.45', '53,239.09', '53.6,239.09', '54.2,240.00', '54.8,241.82', '55.4,244.55', '56,242.73', '56.6,246.36', '57.2,245.45', '57.8,250.00', '58.4,250.00', '59,250.00', '59.6,250.00', '60.2,250.00', '60.8,250.00', '61.4,250.00', '62,250.00', '62.6,250.00', '63.2,251.90', '63.8,253.40', '64.4,259.20', '65,259.08', '65.6,263.23', '66.1,266.04', '66.7,267.48', '67.3,267.59', '67.9,270.96', '68.5,267.48', '69.1,267.27', '69.7,267.27', '70.3,270.00', '70.9,275.45', '71.5,273.64', '72.1,274.55', '72.7,278.18', '73.3,279.09', '73.9,281.82', '74.5,286.36', '75.1,287.27', '75.7,289.09', '76.3,291.82', '76.9,295.45', '77.5,300.00', '78.1,300.00', '78.7,300.00', '79.3,300.00', '79.9,300.00', '80.5,300.00', '81.1,300.00', '81.7,300.00', '82.3,300.00', '82.9,304.55', '83.5,310.42', '84.1,315.06', '84.7,318.39', '85.3,320.33', '85.9,320.84', '86.4,319.90', '87,317.52', '87.6,318.41', '88.2,316.97', '88.8,313.27', '89.4,312.73', '90,313.64', '90.6,313.64', '91.2,312.73', '91.8,310.91', '92.4,308.18', '93,304.55', '93.6,300.00', '94.2,300.00', '94.8,300.00', '95.4,300.00', '96,300.00', '96.6,300.00', '97.2,300.00', '97.8,300.00', '98.4,295.45', '99,291.82', '99.6,289.09', '100.2,287.27', '100.8,286.36', '101.4,286.36', '102,282.73', '102.6,280.91', '103.2,280.91', '103.8,278.18', '104.4,278.18', '105,275.45', '105.6,270.00', '106.2,269.27', '106.8,266.33', '107.4,266.63', '108,265.62', '108.6,263.22', '109.1,259.47', '109.7,260.00', '110.3,254.54', '110.9,253.39', '111.5,251.83', '112.1,245.45', '112.7,246.36', '113.3,242.73', '113.9,240.00', '114.5,238.18', '115.1,237.27', '115.7,232.73', '116.3,230.00', '116.9,224.55', '117.5,226.36', '118.1,225.45', '118.7,221.82', '119.3,220.91', '119.9,218.18', '120.5,213.64', '121.1,212.73', '121.7,210.91', '122.3,208.18', '122.9,204.55', '123.5,200.00', '124.1,195.45', '124.7,191.82', '125.3,189.09', '125.9,187.27', '126.5,186.36', '127.1,186.36', '127.7,182.73', '128.3,180.91', '128.9,180.91', '129.5,178.18', '130.1,178.18', '130.7,175.45', '131.3,170.00', '131.9,167.27', '132.5,167.27', '133.1,165.45', '133.7,167.27', '134.3,162.73', '134.9,161.82', '135.5,160.00', '136.1,157.27', '136.7,153.64', '137.3,154.55', '137.9,150.00', '138.5,145.45', '139.1,146.36', '139.7,142.73', '140.3,144.55', '140.9,141.82', '141.5,140.00', '142.1,139.09', '142.7,139.09', '143.3,135.45', '143.9,133.64', '144.5,133.64', '145.1,130.00', '145.7,128.18', '146.3,123.64', '146.9,126.36', '147.5,126.36', '148.1,123.64', '148.7,123.64', '149.3,121.82', '149.9,118.18', '150.5,112.73', '151.1,110.91', '151.7,108.18', '152.3,109.09', '152.9,108.18', '153.5,110.91', '154.1,112.73', '154.7,113.64', '155.3,113.64', '155.9,112.73', '156.5,110.91', '157.1,108.18', '157.7,100.00', '158.3,92.57', '158.9,90.38', '159.5,88.93', '160.1,88.26', '160.7,88.39', '161.2,89.33', '161.8,91.06', '162.4,93.57', '163,92.17', '163.6,92.47', '164.2,89.09', '164.8,87.27', '165.4,86.36', '166,81.82', '166.6,79.09', '167.2,78.18', '167.8,79.09', '168.4,77.27', '169,78.18', '169.6,76.36', '170.2,76.36', '170.8,73.64', '171.4,73.64', '172,76.36', '172.6,71.82', '173.2,70.00', '173.8,70.91', '174.4,70.00', '175,67.27', '175.6,62.73', '176.2,61.82', '176.8,64.55', '177.4,60.91', '180.4,63.93', '180.4,63.93']

myNewList = []
for item in myList:
	newItem = item.split(',')
	newItem = map(float, newItem)
	myNewList.append(newItem)

myHeader = ['col1', 'col2']

ds = system.dataset.toDataSet(myHeader, myNewList)

2 Likes

Only posting to say @ethomason use of map is cunning and here is a one liner variation if youre into list comprehension.

myList = ['9.4,-104.55', '10,-89.09', '10.6,-74.55', '11.2,-62.73', '11.8,-50.00', '12.4,-37.27', '13,-20.91', '13.6,-7.27', '14.2,7.27', '14.8,20.91', '15.4,41.82', '16,58.18', '16.6,78.18', '17.2,100.00', '17.8,121.82', '18.4,141.82', '19,158.18', '19.6,174.55', '20.2,184.55', '20.8,193.21', '21.4,198.08', '22,203.66', '22.6,208.94', '23.2,213.01', '23.7,215.82', '24.3,217.35', '24.9,217.59', '25.5,216.56', '26.1,218.91', '26.7,219.09', '27.3,219.09', '27.9,217.27', '28.5,213.64', '29.1,213.64', '29.7,217.27', '30.3,219.09', '30.9,219.09', '31.5,217.27', '32.1,213.64', '32.7,218.18', '33.3,220.91', '33.9,221.82', '34.5,220.91', '35.1,218.18', '35.7,218.18', '36.3,220.91', '36.9,221.82', '37.5,220.91', '38.1,222.73', '38.7,221.82', '39.3,223.64', '39.9,223.64', '40.5,223.53', '41.1,225.77', '41.7,224.94', '42.3,226.59', '42.9,230.68', '43.4,231.62', '44,229.39', '44.6,234.26', '45.2,235.92', '45.8,234.46', '46.4,234.55', '47,232.73', '47.6,232.73', '48.2,234.55', '48.8,232.73', '49.4,232.73', '50,234.55', '50.6,232.73', '51.2,237.27', '51.8,238.18', '52.4,235.45', '53,239.09', '53.6,239.09', '54.2,240.00', '54.8,241.82', '55.4,244.55', '56,242.73', '56.6,246.36', '57.2,245.45', '57.8,250.00', '58.4,250.00', '59,250.00', '59.6,250.00', '60.2,250.00', '60.8,250.00', '61.4,250.00', '62,250.00', '62.6,250.00', '63.2,251.90', '63.8,253.40', '64.4,259.20', '65,259.08', '65.6,263.23', '66.1,266.04', '66.7,267.48', '67.3,267.59', '67.9,270.96', '68.5,267.48', '69.1,267.27', '69.7,267.27', '70.3,270.00', '70.9,275.45', '71.5,273.64', '72.1,274.55', '72.7,278.18', '73.3,279.09', '73.9,281.82', '74.5,286.36', '75.1,287.27', '75.7,289.09', '76.3,291.82', '76.9,295.45', '77.5,300.00', '78.1,300.00', '78.7,300.00', '79.3,300.00', '79.9,300.00', '80.5,300.00', '81.1,300.00', '81.7,300.00', '82.3,300.00', '82.9,304.55', '83.5,310.42', '84.1,315.06', '84.7,318.39', '85.3,320.33', '85.9,320.84', '86.4,319.90', '87,317.52', '87.6,318.41', '88.2,316.97', '88.8,313.27', '89.4,312.73', '90,313.64', '90.6,313.64', '91.2,312.73', '91.8,310.91', '92.4,308.18', '93,304.55', '93.6,300.00', '94.2,300.00', '94.8,300.00', '95.4,300.00', '96,300.00', '96.6,300.00', '97.2,300.00', '97.8,300.00', '98.4,295.45', '99,291.82', '99.6,289.09', '100.2,287.27', '100.8,286.36', '101.4,286.36', '102,282.73', '102.6,280.91', '103.2,280.91', '103.8,278.18', '104.4,278.18', '105,275.45', '105.6,270.00', '106.2,269.27', '106.8,266.33', '107.4,266.63', '108,265.62', '108.6,263.22', '109.1,259.47', '109.7,260.00', '110.3,254.54', '110.9,253.39', '111.5,251.83', '112.1,245.45', '112.7,246.36', '113.3,242.73', '113.9,240.00', '114.5,238.18', '115.1,237.27', '115.7,232.73', '116.3,230.00', '116.9,224.55', '117.5,226.36', '118.1,225.45', '118.7,221.82', '119.3,220.91', '119.9,218.18', '120.5,213.64', '121.1,212.73', '121.7,210.91', '122.3,208.18', '122.9,204.55', '123.5,200.00', '124.1,195.45', '124.7,191.82', '125.3,189.09', '125.9,187.27', '126.5,186.36', '127.1,186.36', '127.7,182.73', '128.3,180.91', '128.9,180.91', '129.5,178.18', '130.1,178.18', '130.7,175.45', '131.3,170.00', '131.9,167.27', '132.5,167.27', '133.1,165.45', '133.7,167.27', '134.3,162.73', '134.9,161.82', '135.5,160.00', '136.1,157.27', '136.7,153.64', '137.3,154.55', '137.9,150.00', '138.5,145.45', '139.1,146.36', '139.7,142.73', '140.3,144.55', '140.9,141.82', '141.5,140.00', '142.1,139.09', '142.7,139.09', '143.3,135.45', '143.9,133.64', '144.5,133.64', '145.1,130.00', '145.7,128.18', '146.3,123.64', '146.9,126.36', '147.5,126.36', '148.1,123.64', '148.7,123.64', '149.3,121.82', '149.9,118.18', '150.5,112.73', '151.1,110.91', '151.7,108.18', '152.3,109.09', '152.9,108.18', '153.5,110.91', '154.1,112.73', '154.7,113.64', '155.3,113.64', '155.9,112.73', '156.5,110.91', '157.1,108.18', '157.7,100.00', '158.3,92.57', '158.9,90.38', '159.5,88.93', '160.1,88.26', '160.7,88.39', '161.2,89.33', '161.8,91.06', '162.4,93.57', '163,92.17', '163.6,92.47', '164.2,89.09', '164.8,87.27', '165.4,86.36', '166,81.82', '166.6,79.09', '167.2,78.18', '167.8,79.09', '168.4,77.27', '169,78.18', '169.6,76.36', '170.2,76.36', '170.8,73.64', '171.4,73.64', '172,76.36', '172.6,71.82', '173.2,70.00', '173.8,70.91', '174.4,70.00', '175,67.27', '175.6,62.73', '176.2,61.82', '176.8,64.55', '177.4,60.91', '180.4,63.93', '180.4,63.93']

system.dataset.toDataSet(['col1', 'col2'], [map(float, i.split(',')) for i in myList])

Hello @raymond1982 and @ethomason
I tried both ideas which basically the same and nice, but the List contains an whole number (see the second element in list) (I believe) which throws an error as,

Traceback (most recent call last):

  File "<event:propertyChange>", line 143, in <module>

  File "<event:propertyChange>", line 18, in ReadFile

  File "<event:propertyChange>", line 131, in CheckData

ValueError: invalid literal for __float__: ['10'



Ignition v7.8.5 (b2016120813)
Java: Oracle Corporation 1.8.0_131

Thanks for your help.

I tested it in script console before posting it.
Prior to making a basic dataset it prints like this.

[[9.4, -104.55], [10.0, -89.09], [10.6, -74.55], [11.2, -62.73], [11.8, -50.0], [12.4, -37.27], [13.0, -20.91], [13.6, -7.27], [14.2, 7.27], [14.8, 20.91], [15.4, 41.82], [16.0, 58.18], [16.6, 78.18], [17.2, 100.0], [17.8, 121.82], [18.4, 141.82], [19.0, 158.18], [19.6, 174.55], [20.2, 184.55], [20.8, 193.21], [21.4, 198.08], [22.0, 203.66], [22.6, 208.94], [23.2, 213.01], [23.7, 215.82], [24.3, 217.35], [24.9, 217.59], [25.5, 216.56], [26.1, 218.91], [26.7, 219.09], [27.3, 219.09], [27.9, 217.27], [28.5, 213.64], [29.1, 213.64], [29.7, 217.27], [30.3, 219.09], [30.9, 219.09], [31.5, 217.27], [32.1, 213.64], [32.7, 218.18], [33.3, 220.91], [33.9, 221.82], [34.5, 220.91], [35.1, 218.18], [35.7, 218.18], [36.3, 220.91], [36.9, 221.82], [37.5, 220.91], [38.1, 222.73], [38.7, 221.82], [39.3, 223.64], [39.9, 223.64], [40.5, 223.53], [41.1, 225.77], [41.7, 224.94], [42.3, 226.59], [42.9, 230.68], [43.4, 231.62], [44.0, 229.39], [44.6, 234.26], [45.2, 235.92], [45.8, 234.46], [46.4, 234.55], [47.0, 232.73], [47.6, 232.73], [48.2, 234.55], [48.8, 232.73], [49.4, 232.73], [50.0, 234.55], [50.6, 232.73], [51.2, 237.27], [51.8, 238.18], [52.4, 235.45], [53.0, 239.09], [53.6, 239.09], [54.2, 240.0], [54.8, 241.82], [55.4, 244.55], [56.0, 242.73], [56.6, 246.36], [57.2, 245.45], [57.8, 250.0], [58.4, 250.0], [59.0, 250.0], [59.6, 250.0], [60.2, 250.0], [60.8, 250.0], [61.4, 250.0], [62.0, 250.0], [62.6, 250.0], [63.2, 251.9], [63.8, 253.4], [64.4, 259.2], [65.0, 259.08], [65.6, 263.23], [66.1, 266.04], [66.7, 267.48], [67.3, 267.59], [67.9, 270.96], [68.5, 267.48], [69.1, 267.27], [69.7, 267.27], [70.3, 270.0], [70.9, 275.45], [71.5, 273.64], [72.1, 274.55], [72.7, 278.18], [73.3, 279.09], [73.9, 281.82], [74.5, 286.36], [75.1, 287.27], [75.7, 289.09], [76.3, 291.82], [76.9, 295.45], [77.5, 300.0], [78.1, 300.0], [78.7, 300.0], [79.3, 300.0], [79.9, 300.0], [80.5, 300.0], [81.1, 300.0], [81.7, 300.0], [82.3, 300.0], [82.9, 304.55], [83.5, 310.42], [84.1, 315.06], [84.7, 318.39], [85.3, 320.33], [85.9, 320.84], [86.4, 319.9], [87.0, 317.52], [87.6, 318.41], [88.2, 316.97], [88.8, 313.27], [89.4, 312.73], [90.0, 313.64], [90.6, 313.64], [91.2, 312.73], [91.8, 310.91], [92.4, 308.18], [93.0, 304.55], [93.6, 300.0], [94.2, 300.0], [94.8, 300.0], [95.4, 300.0], [96.0, 300.0], [96.6, 300.0], [97.2, 300.0], [97.8, 300.0], [98.4, 295.45], [99.0, 291.82], [99.6, 289.09], [100.2, 287.27], [100.8, 286.36], [101.4, 286.36], [102.0, 282.73], [102.6, 280.91], [103.2, 280.91], [103.8, 278.18], [104.4, 278.18], [105.0, 275.45], [105.6, 270.0], [106.2, 269.27], [106.8, 266.33], [107.4, 266.63], [108.0, 265.62], [108.6, 263.22], [109.1, 259.47], [109.7, 260.0], [110.3, 254.54], [110.9, 253.39], [111.5, 251.83], [112.1, 245.45], [112.7, 246.36], [113.3, 242.73], [113.9, 240.0], [114.5, 238.18], [115.1, 237.27], [115.7, 232.73], [116.3, 230.0], [116.9, 224.55], [117.5, 226.36], [118.1, 225.45], [118.7, 221.82], [119.3, 220.91], [119.9, 218.18], [120.5, 213.64], [121.1, 212.73], [121.7, 210.91], [122.3, 208.18], [122.9, 204.55], [123.5, 200.0], [124.1, 195.45], [124.7, 191.82], [125.3, 189.09], [125.9, 187.27], [126.5, 186.36], [127.1, 186.36], [127.7, 182.73], [128.3, 180.91], [128.9, 180.91], [129.5, 178.18], [130.1, 178.18], [130.7, 175.45], [131.3, 170.0], [131.9, 167.27], [132.5, 167.27], [133.1, 165.45], [133.7, 167.27], [134.3, 162.73], [134.9, 161.82], [135.5, 160.0], [136.1, 157.27], [136.7, 153.64], [137.3, 154.55], [137.9, 150.0], [138.5, 145.45], [139.1, 146.36], [139.7, 142.73], [140.3, 144.55], [140.9, 141.82], [141.5, 140.0], [142.1, 139.09], [142.7, 139.09], [143.3, 135.45], [143.9, 133.64], [144.5, 133.64], [145.1, 130.0], [145.7, 128.18], [146.3, 123.64], [146.9, 126.36], [147.5, 126.36], [148.1, 123.64], [148.7, 123.64], [149.3, 121.82], [149.9, 118.18], [150.5, 112.73], [151.1, 110.91], [151.7, 108.18], [152.3, 109.09], [152.9, 108.18], [153.5, 110.91], [154.1, 112.73], [154.7, 113.64], [155.3, 113.64], [155.9, 112.73], [156.5, 110.91], [157.1, 108.18], [157.7, 100.0], [158.3, 92.57], [158.9, 90.38], [159.5, 88.93], [160.1, 88.26], [160.7, 88.39], [161.2, 89.33], [161.8, 91.06], [162.4, 93.57], [163.0, 92.17], [163.6, 92.47], [164.2, 89.09], [164.8, 87.27], [165.4, 86.36], [166.0, 81.82], [166.6, 79.09], [167.2, 78.18], [167.8, 79.09], [168.4, 77.27], [169.0, 78.18], [169.6, 76.36], [170.2, 76.36], [170.8, 73.64], [171.4, 73.64], [172.0, 76.36], [172.6, 71.82], [173.2, 70.0], [173.8, 70.91], [174.4, 70.0], [175.0, 67.27], [175.6, 62.73], [176.2, 61.82], [176.8, 64.55], [177.4, 60.91], [180.4, 63.93], [180.4, 63.93]]

Do me a favor and run this and post the result.

print map(type, myList[:20])

@raymond1982
I have the same answer as yours in Script console,
If I run code as below,

myList = ['9.4,-104.55', '10,-89.09', '10.6,-74.55', '11.2,-62.73', '11.8,-50.00', '12.4,-37.27', '13,-20.91', '13.6,-7.27', '14.2,7.27', '14.8,20.91', '15.4,41.82', '16,58.18', '16.6,78.18', '17.2,100.00', '17.8,121.82', '18.4,141.82', '19,158.18', '19.6,174.55', '20.2,184.55', '20.8,193.21', '21.4,198.08', '22,203.66', '22.6,208.94', '23.2,213.01', '23.7,215.82', '24.3,217.35', '24.9,217.59', '25.5,216.56', '26.1,218.91', '26.7,219.09', '27.3,219.09', '27.9,217.27', '28.5,213.64', '29.1,213.64', '29.7,217.27', '30.3,219.09', '30.9,219.09', '31.5,217.27', '32.1,213.64', '32.7,218.18', '33.3,220.91', '33.9,221.82', '34.5,220.91', '35.1,218.18', '35.7,218.18', '36.3,220.91', '36.9,221.82', '37.5,220.91', '38.1,222.73', '38.7,221.82', '39.3,223.64', '39.9,223.64', '40.5,223.53', '41.1,225.77', '41.7,224.94', '42.3,226.59', '42.9,230.68', '43.4,231.62', '44,229.39', '44.6,234.26', '45.2,235.92', '45.8,234.46', '46.4,234.55', '47,232.73', '47.6,232.73', '48.2,234.55', '48.8,232.73', '49.4,232.73', '50,234.55', '50.6,232.73', '51.2,237.27', '51.8,238.18', '52.4,235.45', '53,239.09', '53.6,239.09', '54.2,240.00', '54.8,241.82', '55.4,244.55', '56,242.73', '56.6,246.36', '57.2,245.45', '57.8,250.00', '58.4,250.00', '59,250.00', '59.6,250.00', '60.2,250.00', '60.8,250.00', '61.4,250.00', '62,250.00', '62.6,250.00', '63.2,251.90', '63.8,253.40', '64.4,259.20', '65,259.08', '65.6,263.23', '66.1,266.04', '66.7,267.48', '67.3,267.59', '67.9,270.96', '68.5,267.48', '69.1,267.27', '69.7,267.27', '70.3,270.00', '70.9,275.45', '71.5,273.64', '72.1,274.55', '72.7,278.18', '73.3,279.09', '73.9,281.82', '74.5,286.36', '75.1,287.27', '75.7,289.09', '76.3,291.82', '76.9,295.45', '77.5,300.00', '78.1,300.00', '78.7,300.00', '79.3,300.00', '79.9,300.00', '80.5,300.00', '81.1,300.00', '81.7,300.00', '82.3,300.00', '82.9,304.55', '83.5,310.42', '84.1,315.06', '84.7,318.39', '85.3,320.33', '85.9,320.84', '86.4,319.90', '87,317.52', '87.6,318.41', '88.2,316.97', '88.8,313.27', '89.4,312.73', '90,313.64', '90.6,313.64', '91.2,312.73', '91.8,310.91', '92.4,308.18', '93,304.55', '93.6,300.00', '94.2,300.00', '94.8,300.00', '95.4,300.00', '96,300.00', '96.6,300.00', '97.2,300.00', '97.8,300.00', '98.4,295.45', '99,291.82', '99.6,289.09', '100.2,287.27', '100.8,286.36', '101.4,286.36', '102,282.73', '102.6,280.91', '103.2,280.91', '103.8,278.18', '104.4,278.18', '105,275.45', '105.6,270.00', '106.2,269.27', '106.8,266.33', '107.4,266.63', '108,265.62', '108.6,263.22', '109.1,259.47', '109.7,260.00', '110.3,254.54', '110.9,253.39', '111.5,251.83', '112.1,245.45', '112.7,246.36', '113.3,242.73', '113.9,240.00', '114.5,238.18', '115.1,237.27', '115.7,232.73', '116.3,230.00', '116.9,224.55', '117.5,226.36', '118.1,225.45', '118.7,221.82', '119.3,220.91', '119.9,218.18', '120.5,213.64', '121.1,212.73', '121.7,210.91', '122.3,208.18', '122.9,204.55', '123.5,200.00', '124.1,195.45', '124.7,191.82', '125.3,189.09', '125.9,187.27', '126.5,186.36', '127.1,186.36', '127.7,182.73', '128.3,180.91', '128.9,180.91', '129.5,178.18', '130.1,178.18', '130.7,175.45', '131.3,170.00', '131.9,167.27', '132.5,167.27', '133.1,165.45', '133.7,167.27', '134.3,162.73', '134.9,161.82', '135.5,160.00', '136.1,157.27', '136.7,153.64', '137.3,154.55', '137.9,150.00', '138.5,145.45', '139.1,146.36', '139.7,142.73', '140.3,144.55', '140.9,141.82', '141.5,140.00', '142.1,139.09', '142.7,139.09', '143.3,135.45', '143.9,133.64', '144.5,133.64', '145.1,130.00', '145.7,128.18', '146.3,123.64', '146.9,126.36', '147.5,126.36', '148.1,123.64', '148.7,123.64', '149.3,121.82', '149.9,118.18', '150.5,112.73', '151.1,110.91', '151.7,108.18', '152.3,109.09', '152.9,108.18', '153.5,110.91', '154.1,112.73', '154.7,113.64', '155.3,113.64', '155.9,112.73', '156.5,110.91', '157.1,108.18', '157.7,100.00', '158.3,92.57', '158.9,90.38', '159.5,88.93', '160.1,88.26', '160.7,88.39', '161.2,89.33', '161.8,91.06', '162.4,93.57', '163,92.17', '163.6,92.47', '164.2,89.09', '164.8,87.27', '165.4,86.36', '166,81.82', '166.6,79.09', '167.2,78.18', '167.8,79.09', '168.4,77.27', '169,78.18', '169.6,76.36', '170.2,76.36', '170.8,73.64', '171.4,73.64', '172,76.36', '172.6,71.82', '173.2,70.00', '173.8,70.91', '174.4,70.00', '175,67.27', '175.6,62.73', '176.2,61.82', '176.8,64.55', '177.4,60.91', '180.4,63.93', '180.4,63.93']

print myList
print map(type, myList[:20])

ds =[map(float, i.split(',')) for i in myList]

print ds

print map(type, ds[:20])

I get this,


>>> 
['9.4,-104.55', '10,-89.09', '10.6,-74.55', '11.2,-62.73', '11.8,-50.00', '12.4,-37.27', '13,-20.91', '13.6,-7.27', '14.2,7.27', '14.8,20.91', '15.4,41.82', '16,58.18', '16.6,78.18', '17.2,100.00', '17.8,121.82', '18.4,141.82', '19,158.18', '19.6,174.55', '20.2,184.55', '20.8,193.21', '21.4,198.08', '22,203.66', '22.6,208.94', '23.2,213.01', '23.7,215.82', '24.3,217.35', '24.9,217.59', '25.5,216.56', '26.1,218.91', '26.7,219.09', '27.3,219.09', '27.9,217.27', '28.5,213.64', '29.1,213.64', '29.7,217.27', '30.3,219.09', '30.9,219.09', '31.5,217.27', '32.1,213.64', '32.7,218.18', '33.3,220.91', '33.9,221.82', '34.5,220.91', '35.1,218.18', '35.7,218.18', '36.3,220.91', '36.9,221.82', '37.5,220.91', '38.1,222.73', '38.7,221.82', '39.3,223.64', '39.9,223.64', '40.5,223.53', '41.1,225.77', '41.7,224.94', '42.3,226.59', '42.9,230.68', '43.4,231.62', '44,229.39', '44.6,234.26', '45.2,235.92', '45.8,234.46', '46.4,234.55', '47,232.73', '47.6,232.73', '48.2,234.55', '48.8,232.73', '49.4,232.73', '50,234.55', '50.6,232.73', '51.2,237.27', '51.8,238.18', '52.4,235.45', '53,239.09', '53.6,239.09', '54.2,240.00', '54.8,241.82', '55.4,244.55', '56,242.73', '56.6,246.36', '57.2,245.45', '57.8,250.00', '58.4,250.00', '59,250.00', '59.6,250.00', '60.2,250.00', '60.8,250.00', '61.4,250.00', '62,250.00', '62.6,250.00', '63.2,251.90', '63.8,253.40', '64.4,259.20', '65,259.08', '65.6,263.23', '66.1,266.04', '66.7,267.48', '67.3,267.59', '67.9,270.96', '68.5,267.48', '69.1,267.27', '69.7,267.27', '70.3,270.00', '70.9,275.45', '71.5,273.64', '72.1,274.55', '72.7,278.18', '73.3,279.09', '73.9,281.82', '74.5,286.36', '75.1,287.27', '75.7,289.09', '76.3,291.82', '76.9,295.45', '77.5,300.00', '78.1,300.00', '78.7,300.00', '79.3,300.00', '79.9,300.00', '80.5,300.00', '81.1,300.00', '81.7,300.00', '82.3,300.00', '82.9,304.55', '83.5,310.42', '84.1,315.06', '84.7,318.39', '85.3,320.33', '85.9,320.84', '86.4,319.90', '87,317.52', '87.6,318.41', '88.2,316.97', '88.8,313.27', '89.4,312.73', '90,313.64', '90.6,313.64', '91.2,312.73', '91.8,310.91', '92.4,308.18', '93,304.55', '93.6,300.00', '94.2,300.00', '94.8,300.00', '95.4,300.00', '96,300.00', '96.6,300.00', '97.2,300.00', '97.8,300.00', '98.4,295.45', '99,291.82', '99.6,289.09', '100.2,287.27', '100.8,286.36', '101.4,286.36', '102,282.73', '102.6,280.91', '103.2,280.91', '103.8,278.18', '104.4,278.18', '105,275.45', '105.6,270.00', '106.2,269.27', '106.8,266.33', '107.4,266.63', '108,265.62', '108.6,263.22', '109.1,259.47', '109.7,260.00', '110.3,254.54', '110.9,253.39', '111.5,251.83', '112.1,245.45', '112.7,246.36', '113.3,242.73', '113.9,240.00', '114.5,238.18', '115.1,237.27', '115.7,232.73', '116.3,230.00', '116.9,224.55', '117.5,226.36', '118.1,225.45', '118.7,221.82', '119.3,220.91', '119.9,218.18', '120.5,213.64', '121.1,212.73', '121.7,210.91', '122.3,208.18', '122.9,204.55', '123.5,200.00', '124.1,195.45', '124.7,191.82', '125.3,189.09', '125.9,187.27', '126.5,186.36', '127.1,186.36', '127.7,182.73', '128.3,180.91', '128.9,180.91', '129.5,178.18', '130.1,178.18', '130.7,175.45', '131.3,170.00', '131.9,167.27', '132.5,167.27', '133.1,165.45', '133.7,167.27', '134.3,162.73', '134.9,161.82', '135.5,160.00', '136.1,157.27', '136.7,153.64', '137.3,154.55', '137.9,150.00', '138.5,145.45', '139.1,146.36', '139.7,142.73', '140.3,144.55', '140.9,141.82', '141.5,140.00', '142.1,139.09', '142.7,139.09', '143.3,135.45', '143.9,133.64', '144.5,133.64', '145.1,130.00', '145.7,128.18', '146.3,123.64', '146.9,126.36', '147.5,126.36', '148.1,123.64', '148.7,123.64', '149.3,121.82', '149.9,118.18', '150.5,112.73', '151.1,110.91', '151.7,108.18', '152.3,109.09', '152.9,108.18', '153.5,110.91', '154.1,112.73', '154.7,113.64', '155.3,113.64', '155.9,112.73', '156.5,110.91', '157.1,108.18', '157.7,100.00', '158.3,92.57', '158.9,90.38', '159.5,88.93', '160.1,88.26', '160.7,88.39', '161.2,89.33', '161.8,91.06', '162.4,93.57', '163,92.17', '163.6,92.47', '164.2,89.09', '164.8,87.27', '165.4,86.36', '166,81.82', '166.6,79.09', '167.2,78.18', '167.8,79.09', '168.4,77.27', '169,78.18', '169.6,76.36', '170.2,76.36', '170.8,73.64', '171.4,73.64', '172,76.36', '172.6,71.82', '173.2,70.00', '173.8,70.91', '174.4,70.00', '175,67.27', '175.6,62.73', '176.2,61.82', '176.8,64.55', '177.4,60.91', '180.4,63.93', '180.4,63.93']
[<type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>, <type 'str'>]
[[9.4, -104.55], [10.0, -89.09], [10.6, -74.55], [11.2, -62.73], [11.8, -50.0], [12.4, -37.27], [13.0, -20.91], [13.6, -7.27], [14.2, 7.27], [14.8, 20.91], [15.4, 41.82], [16.0, 58.18], [16.6, 78.18], [17.2, 100.0], [17.8, 121.82], [18.4, 141.82], [19.0, 158.18], [19.6, 174.55], [20.2, 184.55], [20.8, 193.21], [21.4, 198.08], [22.0, 203.66], [22.6, 208.94], [23.2, 213.01], [23.7, 215.82], [24.3, 217.35], [24.9, 217.59], [25.5, 216.56], [26.1, 218.91], [26.7, 219.09], [27.3, 219.09], [27.9, 217.27], [28.5, 213.64], [29.1, 213.64], [29.7, 217.27], [30.3, 219.09], [30.9, 219.09], [31.5, 217.27], [32.1, 213.64], [32.7, 218.18], [33.3, 220.91], [33.9, 221.82], [34.5, 220.91], [35.1, 218.18], [35.7, 218.18], [36.3, 220.91], [36.9, 221.82], [37.5, 220.91], [38.1, 222.73], [38.7, 221.82], [39.3, 223.64], [39.9, 223.64], [40.5, 223.53], [41.1, 225.77], [41.7, 224.94], [42.3, 226.59], [42.9, 230.68], [43.4, 231.62], [44.0, 229.39], [44.6, 234.26], [45.2, 235.92], [45.8, 234.46], [46.4, 234.55], [47.0, 232.73], [47.6, 232.73], [48.2, 234.55], [48.8, 232.73], [49.4, 232.73], [50.0, 234.55], [50.6, 232.73], [51.2, 237.27], [51.8, 238.18], [52.4, 235.45], [53.0, 239.09], [53.6, 239.09], [54.2, 240.0], [54.8, 241.82], [55.4, 244.55], [56.0, 242.73], [56.6, 246.36], [57.2, 245.45], [57.8, 250.0], [58.4, 250.0], [59.0, 250.0], [59.6, 250.0], [60.2, 250.0], [60.8, 250.0], [61.4, 250.0], [62.0, 250.0], [62.6, 250.0], [63.2, 251.9], [63.8, 253.4], [64.4, 259.2], [65.0, 259.08], [65.6, 263.23], [66.1, 266.04], [66.7, 267.48], [67.3, 267.59], [67.9, 270.96], [68.5, 267.48], [69.1, 267.27], [69.7, 267.27], [70.3, 270.0], [70.9, 275.45], [71.5, 273.64], [72.1, 274.55], [72.7, 278.18], [73.3, 279.09], [73.9, 281.82], [74.5, 286.36], [75.1, 287.27], [75.7, 289.09], [76.3, 291.82], [76.9, 295.45], [77.5, 300.0], [78.1, 300.0], [78.7, 300.0], [79.3, 300.0], [79.9, 300.0], [80.5, 300.0], [81.1, 300.0], [81.7, 300.0], [82.3, 300.0], [82.9, 304.55], [83.5, 310.42], [84.1, 315.06], [84.7, 318.39], [85.3, 320.33], [85.9, 320.84], [86.4, 319.9], [87.0, 317.52], [87.6, 318.41], [88.2, 316.97], [88.8, 313.27], [89.4, 312.73], [90.0, 313.64], [90.6, 313.64], [91.2, 312.73], [91.8, 310.91], [92.4, 308.18], [93.0, 304.55], [93.6, 300.0], [94.2, 300.0], [94.8, 300.0], [95.4, 300.0], [96.0, 300.0], [96.6, 300.0], [97.2, 300.0], [97.8, 300.0], [98.4, 295.45], [99.0, 291.82], [99.6, 289.09], [100.2, 287.27], [100.8, 286.36], [101.4, 286.36], [102.0, 282.73], [102.6, 280.91], [103.2, 280.91], [103.8, 278.18], [104.4, 278.18], [105.0, 275.45], [105.6, 270.0], [106.2, 269.27], [106.8, 266.33], [107.4, 266.63], [108.0, 265.62], [108.6, 263.22], [109.1, 259.47], [109.7, 260.0], [110.3, 254.54], [110.9, 253.39], [111.5, 251.83], [112.1, 245.45], [112.7, 246.36], [113.3, 242.73], [113.9, 240.0], [114.5, 238.18], [115.1, 237.27], [115.7, 232.73], [116.3, 230.0], [116.9, 224.55], [117.5, 226.36], [118.1, 225.45], [118.7, 221.82], [119.3, 220.91], [119.9, 218.18], [120.5, 213.64], [121.1, 212.73], [121.7, 210.91], [122.3, 208.18], [122.9, 204.55], [123.5, 200.0], [124.1, 195.45], [124.7, 191.82], [125.3, 189.09], [125.9, 187.27], [126.5, 186.36], [127.1, 186.36], [127.7, 182.73], [128.3, 180.91], [128.9, 180.91], [129.5, 178.18], [130.1, 178.18], [130.7, 175.45], [131.3, 170.0], [131.9, 167.27], [132.5, 167.27], [133.1, 165.45], [133.7, 167.27], [134.3, 162.73], [134.9, 161.82], [135.5, 160.0], [136.1, 157.27], [136.7, 153.64], [137.3, 154.55], [137.9, 150.0], [138.5, 145.45], [139.1, 146.36], [139.7, 142.73], [140.3, 144.55], [140.9, 141.82], [141.5, 140.0], [142.1, 139.09], [142.7, 139.09], [143.3, 135.45], [143.9, 133.64], [144.5, 133.64], [145.1, 130.0], [145.7, 128.18], [146.3, 123.64], [146.9, 126.36], [147.5, 126.36], [148.1, 123.64], [148.7, 123.64], [149.3, 121.82], [149.9, 118.18], [150.5, 112.73], [151.1, 110.91], [151.7, 108.18], [152.3, 109.09], [152.9, 108.18], [153.5, 110.91], [154.1, 112.73], [154.7, 113.64], [155.3, 113.64], [155.9, 112.73], [156.5, 110.91], [157.1, 108.18], [157.7, 100.0], [158.3, 92.57], [158.9, 90.38], [159.5, 88.93], [160.1, 88.26], [160.7, 88.39], [161.2, 89.33], [161.8, 91.06], [162.4, 93.57], [163.0, 92.17], [163.6, 92.47], [164.2, 89.09], [164.8, 87.27], [165.4, 86.36], [166.0, 81.82], [166.6, 79.09], [167.2, 78.18], [167.8, 79.09], [168.4, 77.27], [169.0, 78.18], [169.6, 76.36], [170.2, 76.36], [170.8, 73.64], [171.4, 73.64], [172.0, 76.36], [172.6, 71.82], [173.2, 70.0], [173.8, 70.91], [174.4, 70.0], [175.0, 67.27], [175.6, 62.73], [176.2, 61.82], [176.8, 64.55], [177.4, 60.91], [180.4, 63.93], [180.4, 63.93]]
[<type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>]
>>> 

Which completely makes sense and that’s what we need.

But, when I run below code in property change script of timer,

Curve1data = ['9.4,-104.55', '10,-89.09', '10.6,-74.55', '11.2,-62.73', '11.8,-50.00', '12.4,-37.27', '13,-20.91', '13.6,-7.27', '14.2,7.27', '14.8,20.91', '15.4,41.82', '16,58.18', '16.6,78.18', '17.2,100.00', '17.8,121.82', '18.4,141.82', '19,158.18', '19.6,174.55', '20.2,184.55', '20.8,193.21', '21.4,198.08', '22,203.66', '22.6,208.94', '23.2,213.01', '23.7,215.82', '24.3,217.35', '24.9,217.59', '25.5,216.56', '26.1,218.91', '26.7,219.09', '27.3,219.09', '27.9,217.27', '28.5,213.64', '29.1,213.64', '29.7,217.27', '30.3,219.09', '30.9,219.09', '31.5,217.27', '32.1,213.64', '32.7,218.18', '33.3,220.91', '33.9,221.82', '34.5,220.91', '35.1,218.18', '35.7,218.18', '36.3,220.91', '36.9,221.82', '37.5,220.91', '38.1,222.73', '38.7,221.82', '39.3,223.64', '39.9,223.64', '40.5,223.53', '41.1,225.77', '41.7,224.94', '42.3,226.59', '42.9,230.68', '43.4,231.62', '44,229.39', '44.6,234.26', '45.2,235.92', '45.8,234.46', '46.4,234.55', '47,232.73', '47.6,232.73', '48.2,234.55', '48.8,232.73', '49.4,232.73', '50,234.55', '50.6,232.73', '51.2,237.27', '51.8,238.18', '52.4,235.45', '53,239.09', '53.6,239.09', '54.2,240.00', '54.8,241.82', '55.4,244.55', '56,242.73', '56.6,246.36', '57.2,245.45', '57.8,250.00', '58.4,250.00', '59,250.00', '59.6,250.00', '60.2,250.00', '60.8,250.00', '61.4,250.00', '62,250.00', '62.6,250.00', '63.2,251.90', '63.8,253.40', '64.4,259.20', '65,259.08', '65.6,263.23', '66.1,266.04', '66.7,267.48', '67.3,267.59', '67.9,270.96', '68.5,267.48', '69.1,267.27', '69.7,267.27', '70.3,270.00', '70.9,275.45', '71.5,273.64', '72.1,274.55', '72.7,278.18', '73.3,279.09', '73.9,281.82', '74.5,286.36', '75.1,287.27', '75.7,289.09', '76.3,291.82', '76.9,295.45', '77.5,300.00', '78.1,300.00', '78.7,300.00', '79.3,300.00', '79.9,300.00', '80.5,300.00', '81.1,300.00', '81.7,300.00', '82.3,300.00', '82.9,304.55', '83.5,310.42', '84.1,315.06', '84.7,318.39', '85.3,320.33', '85.9,320.84', '86.4,319.90', '87,317.52', '87.6,318.41', '88.2,316.97', '88.8,313.27', '89.4,312.73', '90,313.64', '90.6,313.64', '91.2,312.73', '91.8,310.91', '92.4,308.18', '93,304.55', '93.6,300.00', '94.2,300.00', '94.8,300.00', '95.4,300.00', '96,300.00', '96.6,300.00', '97.2,300.00', '97.8,300.00', '98.4,295.45', '99,291.82', '99.6,289.09', '100.2,287.27', '100.8,286.36', '101.4,286.36', '102,282.73', '102.6,280.91', '103.2,280.91', '103.8,278.18', '104.4,278.18', '105,275.45', '105.6,270.00', '106.2,269.27', '106.8,266.33', '107.4,266.63', '108,265.62', '108.6,263.22', '109.1,259.47', '109.7,260.00', '110.3,254.54', '110.9,253.39', '111.5,251.83', '112.1,245.45', '112.7,246.36', '113.3,242.73', '113.9,240.00', '114.5,238.18', '115.1,237.27', '115.7,232.73', '116.3,230.00', '116.9,224.55', '117.5,226.36', '118.1,225.45', '118.7,221.82', '119.3,220.91', '119.9,218.18', '120.5,213.64', '121.1,212.73', '121.7,210.91', '122.3,208.18', '122.9,204.55', '123.5,200.00', '124.1,195.45', '124.7,191.82', '125.3,189.09', '125.9,187.27', '126.5,186.36', '127.1,186.36', '127.7,182.73', '128.3,180.91', '128.9,180.91', '129.5,178.18', '130.1,178.18', '130.7,175.45', '131.3,170.00', '131.9,167.27', '132.5,167.27', '133.1,165.45', '133.7,167.27', '134.3,162.73', '134.9,161.82', '135.5,160.00', '136.1,157.27', '136.7,153.64', '137.3,154.55', '137.9,150.00', '138.5,145.45', '139.1,146.36', '139.7,142.73', '140.3,144.55', '140.9,141.82', '141.5,140.00', '142.1,139.09', '142.7,139.09', '143.3,135.45', '143.9,133.64', '144.5,133.64', '145.1,130.00', '145.7,128.18', '146.3,123.64', '146.9,126.36', '147.5,126.36', '148.1,123.64', '148.7,123.64', '149.3,121.82', '149.9,118.18', '150.5,112.73', '151.1,110.91', '151.7,108.18', '152.3,109.09', '152.9,108.18', '153.5,110.91', '154.1,112.73', '154.7,113.64', '155.3,113.64', '155.9,112.73', '156.5,110.91', '157.1,108.18', '157.7,100.00', '158.3,92.57', '158.9,90.38', '159.5,88.93', '160.1,88.26', '160.7,88.39', '161.2,89.33', '161.8,91.06', '162.4,93.57', '163,92.17', '163.6,92.47', '164.2,89.09', '164.8,87.27', '165.4,86.36', '166,81.82', '166.6,79.09', '167.2,78.18', '167.8,79.09', '168.4,77.27', '169,78.18', '169.6,76.36', '170.2,76.36', '170.8,73.64', '171.4,73.64', '172,76.36', '172.6,71.82', '173.2,70.00', '173.8,70.91', '174.4,70.00', '175,67.27', '175.6,62.73', '176.2,61.82', '176.8,64.55', '177.4,60.91', '180.4,63.93', '180.4,63.93']

ds = [map(float, i.split(',')) for i in Curve1data]

print ds

I get below error in my console,

Traceback (most recent call last):
  File "<event:propertyChange>", line 145, in <module>
  File "<event:propertyChange>", line 18, in ReadFile
  File "<event:propertyChange>", line 137, in CheckData
ValueError: invalid literal for __float__: ['10'

	at org.python.core.Py.ValueError(Py.java:309)
	at org.python.core.PyString.atof(PyString.java:1545)
	at org.python.core.PyString.__float__(PyString.java:772)
	at org.python.core.PyFloat.float_new(PyFloat.java:61)
	at org.python.core.PyFloat$exposed___new__.new_impl(Unknown Source)
	at org.python.core.PyType.invokeNew(PyType.java:466)
	at org.python.core.PyType.type___call__(PyType.java:1558)
	at org.python.core.PyType.__call__(PyType.java:1548)
	at org.python.core.PyObject.__call__(PyObject.java:357)
	at org.python.core.__builtin__.map(__builtin__.java:756)
	at org.python.core.BuiltinFunctions.fancyCall(__builtin__.java:253)
	at org.python.core.BuiltinFunctions.__call__(__builtin__.java:172)
	at org.python.core.PyObject.__call__(PyObject.java:408)
	at org.python.pycode._pyx2499.CheckData$2(<event:propertyChange>:138)
	at org.python.pycode._pyx2499.call_function(<event:propertyChange>)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
	at org.python.core.PyFunction.__call__(PyFunction.java:317)
	at org.python.pycode._pyx2499.ReadFile$1(<event:propertyChange>:20)
	at org.python.pycode._pyx2499.call_function(<event:propertyChange>)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:120)
	at org.python.core.PyFunction.__call__(PyFunction.java:307)
	at org.python.pycode._pyx2499.f$0(<event:propertyChange>:145)
	at org.python.pycode._pyx2499.call_function(<event:propertyChange>)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1275)
	at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:631)
	at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:168)
	at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.access$000(ActionAdapter.java:40)
	at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter$ActionRunner.run(ActionAdapter.java:280)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$500(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Please let me know if you want me to send you the whole code.

Thanks @raymond1982

Just post the whole code here! Ill try and replicate.

Here is the code,

import time
import threading
import os	
import glob

def ReadFile():		
	contents = "C:\\Users\\kshah2\\Desktop\\MDR1.asc"
	if system.file.fileExists(contents):			
		File = system.file.readFileAsString(contents)
		event.source.parent.getComponent('Text Area').text = File
		event.source.running = 0
		event.source.value = 0
 		line_num2 = 0
 		Read = open(contents, "r")
 		for line in Read.readlines():
 			line_num2 += 1
 			if line.find("DATAPOINT") >= 0:
 				CheckData(line_num2 - 1)
	elif event.source.value == 19:
		system.gui.messageBox("No File Exists")

def CheckData(line_num2):
	contents = open("C:\\Users\\kshah2\\Desktop\\MDR1.asc", "r")
	Result = {}
	caption = []
	values = []
	Curve1name = ""
	Curve2name = ""
	Curve3name = ""
	Curve4name = ""
	Curve5name = ""
	Curve6name = ""
	Curve7name = ""
	Curve8name = ""
	Curve9name = ""
	Curve10name = ""
	Curve1data = []
	Curve2data = []
	Curve3data = []
	Curve4data = []
	Curve5data = []
	Curve6data = []
	Curve7data = []
	Curve8data = []
	Curve9data = []
	Curve10data = []
	pointer = 0
	curves = 0
	curve_number = 0
	curve_pointer = 0
	
	for line in contents.readlines():
			if pointer == 0 and line.find("DATAPOINT") >= 0:
				pointer = 1
					
			elif pointer == 1 and line.find("Variable.Caption") >= 0:
				pointer = 2
				C_data = line.split("=")
				C_data = C_data[1].strip()
				caption.append(str(C_data))
					
			elif pointer == 2 and line.find("Variable.Value") >= 0:
				pointer = 0
				C_data = line.split("=")
				C_data = C_data[1].strip()							
				values.append(str(C_data))
			
			elif pointer == 0 and line.find("[CURVE") >= 0 :
				curves = 1
				curve_number += 1
				curve_pointer = 0
					
			elif curves == 1:
				
					if line.find("Variable.Caption") >= 0 and curve_pointer == 0:
						curve_pointer = 1
						C_data = line.split("=")
						C_data = C_data[1].strip()
						exec("Curve"+str(curve_number)+ "name" + " =' "+ str(C_data)  + "'")	
							
					elif curve_pointer == 2:
						if curve_number == 1:						
							if line == '\n':
								curves = 0				
							else:
								C_data = line.split("=")
								C_data = C_data[1].strip()
								C_data = C_data.split(",")
								Curve1data.append(C_data)
								
								
						elif curve_number == 2:						
							if line == '\n':
								curves = 0
							else:
								C_data = line.split("=")
								C_data = C_data[1].strip()
								Curve2data.append(str(C_data))
						
						elif curve_number == 3:					
							if line == '\n':
								curves = 0
							else:
								C_data = line.split("=")
								C_data = C_data[1].strip()
								Curve3data.append(str(C_data))
								
					elif line.find("D0") >= 0 and curve_pointer == 1:
						if curve_number == 1:	
							curve_pointer = 2
							C_data = line.split("=")
							C_data = C_data[1].strip()
							Curve1data.append(str(C_data))		
							
						elif curve_number == 2:
							curve_pointer = 2
							C_data = line.split("=")
							C_data = C_data[1].strip()
							Curve2data.append(str(C_data))
							
						elif curve_number == 3:
							curve_pointer = 2
							C_data = line.split("=")
							C_data = C_data[1].strip()
							Curve3data.append(str(C_data))
				
	contents.close()						
	Curve1data1 = []
#	for item in Curve1data:
#		newItem = item.split(',')
#		newItem = map(float, newItem)
#		Curve1data1.append(newItem)
#		myheader = ['col1', 'col2']
#		ds = system.dataset.toDataSet(myheader, Curve1data1)					
#	Result = dict(zip(caption, values))
#	print Curve1data
#	ds = [map(float, i.split(',')) for i in Curve1data]
#	print ds
#	event.source.parent.getComponent('Table').data = ds
#	event.source.parent.getComponent('Label').text = str(Result)
#	event.source.parent.getComponent('Text Area 1').text = str(Curve1data1)
#	event.source.parent.getComponent('Label 2').text = str(Curve1name)

	
ReadFile()

I know where is the problem now…
When I append the data, list is something like,

['9.4,-104.55', ['10', '-89.09'], ['10.6', '-74.55'], ['11.2', '-62.73'], ['11.8', '-50.00'], ['12.4', '-37.27'], ['13', '-20.91'], ['13.6', '-7.27'], ['14.2', '7.27'], ['14.8', '20.91'], ['15.4', '41.82'], ['16', '58.18'], ['16.6', '78.18'], ['17.2', '100.00'], ['17.8', '121.82'], ['18.4', '141.82'], ['19', '158.18'], ['19.6', '174.55'], ['20.2', '184.55'], ['20.8', '193.21'], ['21.4', '198.08'], ['22', '203.66'], ['22.6', '208.94'], ['23.2', '213.01'], ['23.7', '215.82'], ['24.3', '217.35'], ['24.9', '217.59'], ['25.5', '216.56'], ['26.1', '218.91'], ['26.7', '219.09'], ['27.3', '219.09'], ['27.9', '217.27'], ['28.5', '213.64'], ['29.1', '213.64'], ['29.7', '217.27'], ['30.3', '219.09'], ['30.9', '219.09'], ['31.5', '217.27'], ['32.1', '213.64'], ['32.7', '218.18'], ['33.3', '220.91'], ['33.9', '221.82'], ['34.5', '220.91'], ['35.1', '218.18'], ['35.7', '218.18'], ['36.3', '220.91'], ['36.9', '221.82'], ['37.5', '220.91'], ['38.1', '222.73'], ['38.7', '221.82'], ['39.3', '223.64'], ['39.9', '223.64'], ['40.5', '223.53'], ['41.1', '225.77'], ['41.7', '224.94'], ['42.3', '226.59'], ['42.9', '230.68'], ['43.4', '231.62'], ['44', '229.39'], ['44.6', '234.26'], ['45.2', '235.92'], ['45.8', '234.46'], ['46.4', '234.55'], ['47', '232.73'], ['47.6', '232.73'], ['48.2', '234.55'], ['48.8', '232.73'], ['49.4', '232.73'], ['50', '234.55'], ['50.6', '232.73'], ['51.2', '237.27'], ['51.8', '238.18'], ['52.4', '235.45'], ['53', '239.09'], ['53.6', '239.09'], ['54.2', '240.00'], ['54.8', '241.82'], ['55.4', '244.55'], ['56', '242.73'], ['56.6', '246.36'], ['57.2', '245.45'], ['57.8', '250.00'], ['58.4', '250.00'], ['59', '250.00'], ['59.6', '250.00'], ['60.2', '250.00'], ['60.8', '250.00'], ['61.4', '250.00'], ['62', '250.00'], ['62.6', '250.00'], ['63.2', '251.90'], ['63.8', '253.40'], ['64.4', '259.20'], ['65', '259.08'], ['65.6', '263.23'], ['66.1', '266.04'], ['66.7', '267.48'], ['67.3', '267.59'], ['67.9', '270.96'], ['68.5', '267.48'], ['69.1', '267.27'], ['69.7', '267.27'], ['70.3', '270.00'], ['70.9', '275.45'], ['71.5', '273.64'], ['72.1', '274.55'], ['72.7', '278.18'], ['73.3', '279.09'], ['73.9', '281.82'], ['74.5', '286.36'], ['75.1', '287.27'], ['75.7', '289.09'], ['76.3', '291.82'], ['76.9', '295.45'], ['77.5', '300.00'], ['78.1', '300.00'], ['78.7', '300.00'], ['79.3', '300.00'], ['79.9', '300.00'], ['80.5', '300.00'], ['81.1', '300.00'], ['81.7', '300.00'], ['82.3', '300.00'], ['82.9', '304.55'], ['83.5', '310.42'], ['84.1', '315.06'], ['84.7', '318.39'], ['85.3', '320.33'], ['85.9', '320.84'], ['86.4', '319.90'], ['87', '317.52'], ['87.6', '318.41'], ['88.2', '316.97'], ['88.8', '313.27'], ['89.4', '312.73'], ['90', '313.64'], ['90.6', '313.64'], ['91.2', '312.73'], ['91.8', '310.91'], ['92.4', '308.18'], ['93', '304.55'], ['93.6', '300.00'], ['94.2', '300.00'], ['94.8', '300.00'], ['95.4', '300.00'], ['96', '300.00'], ['96.6', '300.00'], ['97.2', '300.00'], ['97.8', '300.00'], ['98.4', '295.45'], ['99', '291.82'], ['99.6', '289.09'], ['100.2', '287.27'], ['100.8', '286.36'], ['101.4', '286.36'], ['102', '282.73'], ['102.6', '280.91'], ['103.2', '280.91'], ['103.8', '278.18'], ['104.4', '278.18'], ['105', '275.45'], ['105.6', '270.00'], ['106.2', '269.27'], ['106.8', '266.33'], ['107.4', '266.63'], ['108', '265.62'], ['108.6', '263.22'], ['109.1', '259.47'], ['109.7', '260.00'], ['110.3', '254.54'], ['110.9', '253.39'], ['111.5', '251.83'], ['112.1', '245.45'], ['112.7', '246.36'], ['113.3', '242.73'], ['113.9', '240.00'], ['114.5', '238.18'], ['115.1', '237.27'], ['115.7', '232.73'], ['116.3', '230.00'], ['116.9', '224.55'], ['117.5', '226.36'], ['118.1', '225.45'], ['118.7', '221.82'], ['119.3', '220.91'], ['119.9', '218.18'], ['120.5', '213.64'], ['121.1', '212.73'], ['121.7', '210.91'], ['122.3', '208.18'], ['122.9', '204.55'], ['123.5', '200.00'], ['124.1', '195.45'], ['124.7', '191.82'], ['125.3', '189.09'], ['125.9', '187.27'], ['126.5', '186.36'], ['127.1', '186.36'], ['127.7', '182.73'], ['128.3', '180.91'], ['128.9', '180.91'], ['129.5', '178.18'], ['130.1', '178.18'], ['130.7', '175.45'], ['131.3', '170.00'], ['131.9', '167.27'], ['132.5', '167.27'], ['133.1', '165.45'], ['133.7', '167.27'], ['134.3', '162.73'], ['134.9', '161.82'], ['135.5', '160.00'], ['136.1', '157.27'], ['136.7', '153.64'], ['137.3', '154.55'], ['137.9', '150.00'], ['138.5', '145.45'], ['139.1', '146.36'], ['139.7', '142.73'], ['140.3', '144.55'], ['140.9', '141.82'], ['141.5', '140.00'], ['142.1', '139.09'], ['142.7', '139.09'], ['143.3', '135.45'], ['143.9', '133.64'], ['144.5', '133.64'], ['145.1', '130.00'], ['145.7', '128.18'], ['146.3', '123.64'], ['146.9', '126.36'], ['147.5', '126.36'], ['148.1', '123.64'], ['148.7', '123.64'], ['149.3', '121.82'], ['149.9', '118.18'], ['150.5', '112.73'], ['151.1', '110.91'], ['151.7', '108.18'], ['152.3', '109.09'], ['152.9', '108.18'], ['153.5', '110.91'], ['154.1', '112.73'], ['154.7', '113.64'], ['155.3', '113.64'], ['155.9', '112.73'], ['156.5', '110.91'], ['157.1', '108.18'], ['157.7', '100.00'], ['158.3', '92.57'], ['158.9', '90.38'], ['159.5', '88.93'], ['160.1', '88.26'], ['160.7', '88.39'], ['161.2', '89.33'], ['161.8', '91.06'], ['162.4', '93.57'], ['163', '92.17'], ['163.6', '92.47'], ['164.2', '89.09'], ['164.8', '87.27'], ['165.4', '86.36'], ['166', '81.82'], ['166.6', '79.09'], ['167.2', '78.18'], ['167.8', '79.09'], ['168.4', '77.27'], ['169', '78.18'], ['169.6', '76.36'], ['170.2', '76.36'], ['170.8', '73.64'], ['171.4', '73.64'], ['172', '76.36'], ['172.6', '71.82'], ['173.2', '70.00'], ['173.8', '70.91'], ['174.4', '70.00'], ['175', '67.27'], ['175.6', '62.73'], ['176.2', '61.82'], ['176.8', '64.55'], ['177.4', '60.91'], ['180.4', '63.93'], ['180.4', '63.93']]

Where as I suppose to be,

['9.4,-104.55', '10,-89.09', '10.6,-74.55', '11.2,-62.73', '11.8,-50.00', '12.4,-37.27', '13,-20.91', '13.6,-7.27', '14.2,7.27', '14.8,20.91', '15.4,41.82', '16,58.18', '16.6,78.18', '17.2,100.00', '17.8,121.82', '18.4,141.82', '19,158.18', '19.6,174.55', '20.2,184.55', '20.8,193.21', '21.4,198.08', '22,203.66', '22.6,208.94', '23.2,213.01', '23.7,215.82', '24.3,217.35', '24.9,217.59', '25.5,216.56', '26.1,218.91', '26.7,219.09', '27.3,219.09', '27.9,217.27', '28.5,213.64', '29.1,213.64', '29.7,217.27', '30.3,219.09', '30.9,219.09', '31.5,217.27', '32.1,213.64', '32.7,218.18', '33.3,220.91', '33.9,221.82', '34.5,220.91', '35.1,218.18', '35.7,218.18', '36.3,220.91', '36.9,221.82', '37.5,220.91', '38.1,222.73', '38.7,221.82', '39.3,223.64', '39.9,223.64', '40.5,223.53', '41.1,225.77', '41.7,224.94', '42.3,226.59', '42.9,230.68', '43.4,231.62', '44,229.39', '44.6,234.26', '45.2,235.92', '45.8,234.46', '46.4,234.55', '47,232.73', '47.6,232.73', '48.2,234.55', '48.8,232.73', '49.4,232.73', '50,234.55', '50.6,232.73', '51.2,237.27', '51.8,238.18', '52.4,235.45', '53,239.09', '53.6,239.09', '54.2,240.00', '54.8,241.82', '55.4,244.55', '56,242.73', '56.6,246.36', '57.2,245.45', '57.8,250.00', '58.4,250.00', '59,250.00', '59.6,250.00', '60.2,250.00', '60.8,250.00', '61.4,250.00', '62,250.00', '62.6,250.00', '63.2,251.90', '63.8,253.40', '64.4,259.20', '65,259.08', '65.6,263.23', '66.1,266.04', '66.7,267.48', '67.3,267.59', '67.9,270.96', '68.5,267.48', '69.1,267.27', '69.7,267.27', '70.3,270.00', '70.9,275.45', '71.5,273.64', '72.1,274.55', '72.7,278.18', '73.3,279.09', '73.9,281.82', '74.5,286.36', '75.1,287.27', '75.7,289.09', '76.3,291.82', '76.9,295.45', '77.5,300.00', '78.1,300.00', '78.7,300.00', '79.3,300.00', '79.9,300.00', '80.5,300.00', '81.1,300.00', '81.7,300.00', '82.3,300.00', '82.9,304.55', '83.5,310.42', '84.1,315.06', '84.7,318.39', '85.3,320.33', '85.9,320.84', '86.4,319.90', '87,317.52', '87.6,318.41', '88.2,316.97', '88.8,313.27', '89.4,312.73', '90,313.64', '90.6,313.64', '91.2,312.73', '91.8,310.91', '92.4,308.18', '93,304.55', '93.6,300.00', '94.2,300.00', '94.8,300.00', '95.4,300.00', '96,300.00', '96.6,300.00', '97.2,300.00', '97.8,300.00', '98.4,295.45', '99,291.82', '99.6,289.09', '100.2,287.27', '100.8,286.36', '101.4,286.36', '102,282.73', '102.6,280.91', '103.2,280.91', '103.8,278.18', '104.4,278.18', '105,275.45', '105.6,270.00', '106.2,269.27', '106.8,266.33', '107.4,266.63', '108,265.62', '108.6,263.22', '109.1,259.47', '109.7,260.00', '110.3,254.54', '110.9,253.39', '111.5,251.83', '112.1,245.45', '112.7,246.36', '113.3,242.73', '113.9,240.00', '114.5,238.18', '115.1,237.27', '115.7,232.73', '116.3,230.00', '116.9,224.55', '117.5,226.36', '118.1,225.45', '118.7,221.82', '119.3,220.91', '119.9,218.18', '120.5,213.64', '121.1,212.73', '121.7,210.91', '122.3,208.18', '122.9,204.55', '123.5,200.00', '124.1,195.45', '124.7,191.82', '125.3,189.09', '125.9,187.27', '126.5,186.36', '127.1,186.36', '127.7,182.73', '128.3,180.91', '128.9,180.91', '129.5,178.18', '130.1,178.18', '130.7,175.45', '131.3,170.00', '131.9,167.27', '132.5,167.27', '133.1,165.45', '133.7,167.27', '134.3,162.73', '134.9,161.82', '135.5,160.00', '136.1,157.27', '136.7,153.64', '137.3,154.55', '137.9,150.00', '138.5,145.45', '139.1,146.36', '139.7,142.73', '140.3,144.55', '140.9,141.82', '141.5,140.00', '142.1,139.09', '142.7,139.09', '143.3,135.45', '143.9,133.64', '144.5,133.64', '145.1,130.00', '145.7,128.18', '146.3,123.64', '146.9,126.36', '147.5,126.36', '148.1,123.64', '148.7,123.64', '149.3,121.82', '149.9,118.18', '150.5,112.73', '151.1,110.91', '151.7,108.18', '152.3,109.09', '152.9,108.18', '153.5,110.91', '154.1,112.73', '154.7,113.64', '155.3,113.64', '155.9,112.73', '156.5,110.91', '157.1,108.18', '157.7,100.00', '158.3,92.57', '158.9,90.38', '159.5,88.93', '160.1,88.26', '160.7,88.39', '161.2,89.33', '161.8,91.06', '162.4,93.57', '163,92.17', '163.6,92.47', '164.2,89.09', '164.8,87.27', '165.4,86.36', '166,81.82', '166.6,79.09', '167.2,78.18', '167.8,79.09', '168.4,77.27', '169,78.18', '169.6,76.36', '170.2,76.36', '170.8,73.64', '171.4,73.64', '172,76.36', '172.6,71.82', '173.2,70.00', '173.8,70.91', '174.4,70.00', '175,67.27', '175.6,62.73', '176.2,61.82', '176.8,64.55', '177.4,60.91', '180.4,63.93', '180.4,63.93']

Note the single quote difference. Just don’t know how do i not have that appended.

Thanks a lot @raymond1982

Ok this should work and help out a little. I read the code you posted a couple of times and i think i captured everything you were doing. If not let me know and ill be happy to help. You will need to put your component references back in where appropriate.


CURVE = "CURVE"
DATAPOINT = "DATAPOINT"


def getClassToTypeMatrix():
	return {CURVE: CurveHandler, DATAPOINT:DatapointHandler}


def getClassForType(type_):
	return getClassToTypeMatrix().get(type_)


def groomDataBlockName(string):
	"""Groom brackets and spaces from type name"""
	return string.strip().replace('[', '').replace(']', '')


def assertAndCastType(value):
	"""Coerce string to appropriate python type."""
	value = str(value).lower().strip()
	try:
   		return float(value)
	except ValueError:
	  pass
	if value.isnumeric():
		return int(value)
	elif value in ['false', 'true']:
		return True if value == 'true' else False
	return value


class Coordinates:
	"""Basic Coordinates class."""
	
	def __init__(self, x, y):
		self._x = x
		self._y = y
	
	@property
	def x(self):
		return self._x
	
	@property
	def y(self):
		return self._y

	def __call__(self):
		return (self.x, self.y)

	def __repr__(self):
		return '< Coordinates [x=%s, y=%s] >' % (self.x, self.y)

	def points(self):
		return [self.x, self.y]


class GenericDataBlock:
	
	def __init__(self, name, type_):
		self.name = name
		self.type_ = type_
		self.coords = []
	
	def __repr__(self):
		return '< Handler name=%s, type=%s, order=%s >' % (self.name,  self.type_, self.order)

	def load(self, chunk):
		pass

	def getHeader(self):
		return ['x', 'y']

	def getCoordsArray(self):
		return []
	
	@property
	def order(self):
		order = [i for i in self.name if i.isnumeric()]
		if len(order) > 0:
			return int(''.join(order))
		return -99

	def getResult(self):
		return []


class CurveHandler(GenericDataBlock):
	
	def load(self, chunk):
		key_value_groups = chunk.split('\n')
		for key_value_pair in key_value_groups:
			#print key_value_pair
			# Key value pair is only valid if the line contains a '='
			if '=' in key_value_pair:
				# lets get rid of spaces and split on the '='
				key_value_pair = key_value_pair.replace(' ','').split('=')
				#the split must be equal otherwise it is invalid.
				if len(key_value_pair) == 2:
					# using spread operator for speed
					key, value = key_value_pair
					# converting the periods to underscores so we can set the
					# key as the attribute.
					if '.' in key:
						key = key.replace('.', '_')
						# setting the key value as class attributes.
						# since thay aren coords we will use them as instance vars.
						setattr(self, key, assertAndCastType(value))
					else:
						# Test for x y seperator in string
						if ',' in value:
							# split on seperator
							coords = value.split(',')
							if len(coords) == 2:
								x, y = coords
								self.coords.append(
									Coordinates(assertAndCastType(x), assertAndCastType(y))
								)

	def getCoordsArray(self):
		return [data() for data in self.coords]

	def getDataset(self):
		return system.dataset.toDataSet(self.getHeader(), self.getCoordsArray())


class DatapointHandler(GenericDataBlock):

	def load(self, chunk):
		key_value_groups = chunk.split('\n')
		for key_value_pair in key_value_groups:
			# Key value pair is only valid if the line contains a '='
			if '=' in key_value_pair:
				# lets get rid of spaces and split on the '='
				key_value_pair = key_value_pair.replace(' ','').split('=')
				# the split must be equal other wis it is invalid.
				if len(key_value_pair) == 2:
					# using spread operator for speed
					key, value = key_value_pair
					# converting the periods to underscores so we can set the
					# key as the attribute.
					key = key.replace('.', '_')
					# setting the key value as class attributes.
					setattr(self, key, assertAndCastType(value))
		
	def getResult(self):
		return self.Variable_Caption 

	def getVariableCaption(self):
		return getattr(self, 'Variable_Caption', 'Empty')
	
	def getVariableValue(self):
		return getattr(self, 'Variable_Value', 'Empty')

	def getResult(self):
		return (self.getVariableCaption(), self.getVariableValue())


def ProcessASCList(asc_list):		

 		data_block_owner = None
 		block_data = ''
 		block_start = False
 		data_object_array = []
 		
 		for line in asc_list:
 			# testing for the '[' indicates we have hit another group.
 			# if black_start is True that means we are at the end of this block.
			if '[' in line and block_start:
				# Clear block start.
				block_start = False
				# verify that we have a obj assigned as the block owner.
				if data_block_owner:
					# load block to handler.
					data_block_owner.load(block_data)
					# append handler to array.
					data_object_array.append(data_block_owner)
					# clear block data.
					block_data = ''
 			
 			elif block_start:
 				# We are in the block here. Append line and start the loop over
 				# The continue statment cuts the loop short saving us from 
 				# testing conditions that are irrelevant at this stage.
 				block_data = block_data + line
 				continue
			#  clear type_
			type_ = None
			if CURVE in line:
				type_ = CURVE
		
 			elif DATAPOINT in line:
 				type_ = DATAPOINT
 			
 			if type_ and not block_start:
				handler = getClassForType(type_)
				if handler:
					data_block_owner = handler(groomDataBlockName(line), type_)
					block_start = True

		return data_object_array


def getListFromFile(path):
	# verify file is present.
	if system.file.fileExists(path):
		# open file
		asc_file = open(path, "r")
		# read the contents to a list in memory
		asc_list = [line for line in asc_file.readlines()]
		# close file object.
		asc_file.close()
		# return the list for iteration
		return asc_list
	return ''


def getHandlerByName(name, handler_array):
	for handler in handler_array:
		if handler.name == name:
			return handler
	raise Exception('Unknown Handler Name: %s' % name)
	return GenericDataBlock('Uknown', 'Uknown')


def filterHandlerListOnType(type_, handler_array):
	return [handler for handler in handler_list if handler.type_ == type_]


def orderHandlerList(handler_array):
	return sorted(handler_array, key=lambda x: x.order)


path = "C:\\Users\\kshah2\\Desktop\\MDR1.asc"
asc_list = getListFromFile(path)
handler_list = ProcessASCList(asc_list)


# Curve Example
handler_name = 'CURVE1'
handler = getHandlerByName(handler_name, handler_list)
print handler.getCoordsArray()
print handler.getDataset() # <-- What you asked for.


# Datapoint example
handler_name = 'DATAPOINT1'
handler = getHandlerByName(handler_name, handler_list)
print handler.getResult()


# Example
# print list of the datapoint names
print [handler.name for handler in handler_list]


# Example
# Filter handler list by type
type_0 = CURVE
filtered_handler_list = filterHandlerListOnType(type_0, handler_list)
print filtered_handler_list


# Example
# Combine result values for multiple datapoints.
results_array = [handler.getResult() for handler in filterHandlerListOnType(DATAPOINT, handler_list)]
print results_array


# Example
# Merge Results caption and value
results_as_dict = dict(results_array)
print results_as_dict


# Example 
# Order DATAPOINT handler list
dphl = filterHandlerListOnType(DATAPOINT, handler_list)
dphl_ordered = orderHandlerList(dphl)
print dphl_ordered


#event.source.parent.getComponent('Text Area').text = ''.join(asc_list)
#event.source.running = 0
#event.source.value = 0
1 Like

Holy Smokes…
could never have thought doing something like this.
Thanks a lot sir.
I got that working but this is Great…

1 Like