text-processing

perl plotting for multiple datasets in .csv file

…衆ロ難τιáo~ 提交于 2019-12-10 11:58:04
问题 Merged with perl plotting using GD:Graph. I have a .csv file with the following data.(I open CSV file as comma separated file) file1 date1 1 76.09 date10 10 87.09 date11 11 89.89 date2 2 66.5 date3 3 78.89 date4 4 87.98 date5 5 57 date6 6 57.98 date7 7 34.32 date8 8 45.76 date9 9 34.99 file2 date1 1 82.45 date2 2 86.23 file3 date1 1 65.76 date10 10 34.89 date11 11 23.79 date12 12 86.23 date2 2 23.78 date3 3 45.78 date4 4 34.78 date5 5 67.89 date6 6 34.78 date7 7 78.45 date8 8 67.89 date9 9 86

How to work with data from NBA.com?

风格不统一 提交于 2019-12-10 11:07:47
问题 I found Greg Reda's blog post about scraping HTML from nba.com: http://www.gregreda.com/2015/02/15/web-scraping-finding-the-api/ I tried to work with the code he wrote there: import requests import json url = 'http://stats.nba.com/stats/leaguedashteamshotlocations?Conference=&DateFr' + \ 'om=&DateTo=&DistanceRange=By+Zone&Division=&GameScope=&GameSegment=&LastN' + \ 'Games=0&LeagueID=00&Location=&MeasureType=Opponent&Month=0&OpponentTeamID' + \ '=0&Outcome=&PORound=0&PaceAdjust=N&PerMode

What is the fastest way to remove a number from the beginning of so many files?

橙三吉。 提交于 2019-12-10 10:58:22
问题 I have 1000 files each having one million lines. Each line has the following form: a number,a text I want to remove all of the numbers from the beginning of every line of every file. including the , Example: 14671823,aboasdyflj -> aboasdyflj What I'm doing is: os.system("sed -i -- 's/^.*,//g' data/*") and it works fine but it's taking a huge amount of time. What is the fastest way to do this? I'm coding in python. 回答1: This is much faster: cut -f2 -d ',' data.txt > tmp.txt && mv tmp.txt data

Python removing extra special unicode characters

浪尽此生 提交于 2019-12-10 10:35:42
问题 I'm working with some text in python, it's already in unicode format internally but I would like to get rid of some special characters and replace them with more standard versions. I currently have a line that looks like this, but it's getting ever more complex and I see it will eventually bring more trouble. tmp = infile.lower().replace(u"\u2018", "'").replace(u"\u2019", "'").replace(u"\u2013", "").replace(u"\u2026", "") for example the u\2018 and \u2019 are left and right single quotes.

Which function should I use to read unstructured text file into R? [closed]

こ雲淡風輕ζ 提交于 2019-12-10 02:44:53
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . This is my first ever question here and I'm new to R, trying to figure out my first step in how to do data processing, please keep it easy : ) I'm wondering what would be the best function and a useful data structure in R to load unstructured text data for further processing. For

How to extract data from a text file using R or PowerShell?

ぃ、小莉子 提交于 2019-12-09 12:48:27
问题 I have a text file containing data like this: This is just text ------------------------------- Username: SOMETHI C: [Text] Account: DFAG Finish time: 1-JAN-2011 00:31:58.91 Process ID: 2028aaB Start time: 31-DEC-2010 20:27:15.30 This is just text ------------------------------- Username: SOMEGG C: [Text] Account: DFAG Finish time: 1-JAN-2011 00:31:58.91 Process ID: 20dd33DB Start time: 12-DEC-2010 20:27:15.30 This is just text ------------------------------- Username: SOMEYY C: [Text]

How to compute the number of times word appeared in a file or in some range

自作多情 提交于 2019-12-09 08:14:11
问题 Sometimes I want to see how many times a certain function is called in a file or a code block. How do you do that? I am using Vim 7.2. I presume you have to use !wc or some such. 回答1: For counting the number of times some pattern occurs, use: :%s/pattern//gn The 'n' flag count the number of occurrences without doing any change to the document. For counting the total number of words, you have several options. If you want to run as an external command: :!wc -w % If you want to run it inside VIM

PHP: Text Processing preg_match function

喜欢而已 提交于 2019-12-08 13:10:57
问题 <?php $eqn1="0.068683000000003x1+2.046124y1+-0.4153z1=0.486977512"; preg_match("/\b[0-9]*\b/",$eqn1,$vx1); echo "X1 is: $vx1[0]"; ?> Can someone tell me, how to store the value of x1 (that is, 0.068683000000003) in the variable $vx1? The output is: X1 is: 0 回答1: 1)put semicolon after each sentences; 2)use echo "X1 is:" $vx1[0]; instead ofecho "X1 is: $vx1[0]"; <?php $eqn1="0.068683000000003x1+2.046124y1+-0.4153z1=0.486977512"; preg_match("/\b[0-9]*\b/",$eqn1,$vx1); echo "X1 is:" .$vx1[0]; 回答2

Split a text file into muliple files

左心房为你撑大大i 提交于 2019-12-08 08:43:30
问题 My sample text file is the following: 1. -77.41936 37.238461 2. -77.41932 37.238466 3. -77.419275 37.238454 4. -77.419247 37.23843 5. -77.419235 37.2384 6. -77.419243 37.238363 7. -77.419268 37.238337 8. -77.419292 37.238326 9. #N/A #N/A 10. #N/A #N/A 11. #N/A #N/A 12. #N/A #N/A 13. #N/A #N/A 14. #N/A #N/A 15. #N/A #N/A 16. #N/A #N/A 17. -77.417944 37.23563 18. -77.417906 37.235634 19. -77.417869 37.235624 20. -77.417845 37.235605 21. -77.417829 37.235583 22. -77.417826 37.235552 23. -77

problem in extracting the data from text file

我只是一个虾纸丫 提交于 2019-12-08 02:52:14
问题 i am new to python , and I want to extract the data from this format FBpp0143497 5 151 5 157 PF00339.22 Arrestin_N Domain 1 135 149 83.4 1.1e-23 1 CL0135 FBpp0143497 183 323 183 324 PF02752.15 Arrestin_C Domain 1 137 138 58.5 6e-16 1 CL0135 FBpp0131987 60 280 51 280 PF00089.19 Trypsin Domain 14 219 219 127.7 3.7e-37 1 CL0124 to this format FBpp0143497 5 151 Arrestin_N 1.1e-23 FBpp0143497 183 323 Arrestin_C 6e-16 I have written code in hope that it works but it does not work , please help!