473,588 Members | 2,527 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filtering a large data file

2 New Member
Hi I have a large data file and I'm only interested in rows with specific x values of 4.125 as shown below. Now because the value of 4.125 relates to the stop position of the ion, the corresponding start position is also of interest to me and I want to keep this information in the array. How do I write a program which effectively finds the x stop position of 4.125 and retains the ion start position? I have attached the data file I'm using.

This is the code I have developed so far but does not work:

Expand|Select|Wrap|Line Numbers
  1. import pandas as pd 
  2. import numpy as np
  3.  
  4. opts = pd.read_csv('Ambre_2.dat',sep = ',', low_memory = False)
  5. df = pd.DataFrame(opts)
  6.  
  7. X = df.iloc[:,3]
  8. IonN = df.iloc[:,0]
  9. tol = 1e-6
  10. Fltr = 4.125
  11.  
  12. filterreddata = df[abs(df.X-Fltr)<tol,:]
  13. filteredions = df(np.in1d(df.IonN, filterreddata.IonN), :]
  14. filteredions[2:2:end, :] = []
  15. f = open('ions.csv', 'w')
  16. f.write(tabulate(filteredions))
  17. f.close()
Jun 29 '18 #1
2 1549
ariane92
2 New Member
In the example shown below I would be interested in keeping the information of ion # 3849096.

"Ion N","Mass","Char ge","X","Y","Z" ,"Azm","Elv","K E" 3849094,0.00054 858,-1,66.5216,-51,-3.8,-180,88.7,18160 3849094,0.00054 858,-1,27.3925,30.35 32,-4.07076,-177.1,41.5494,1 7697.2 3849095,0.00054 858,-1,66.5216,-51,-3.7,-180,88.7,18160 3849095,0.00054 858,-1,26.6277,31.00 39,-3.91402,-177.096,40.8293 ,17699.4 3849096,0.00054 858,-1,66.5216,-51,-3.6,-180,88.7,18160 3849096,0.00054 858,-1,4.125,44.9887 ,-2.47517,-176.363,25.715, 17711.1
Jun 29 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4654
by: Domenico Discepola | last post by:
Hello all. Before my arrival at my current employer, our consultants physically set up our MSSQL 7 server as follows: drive c: contains the mssql engine drive d: contains the transaction log drive e: contains the data files No filegroups were set up and the data files consist of only 1 large physical file. Currently, our data file is >10GB. When I was trained on the physical aspects of sqlserver, I was told to never create physical...
0
1422
by: Roland Hall | last post by:
I'm looking for information on working with large data files using FSO, XML. I have a program which creates a large CSV file, over 7mb. It's a rate table of freight shipping costs. There are certain fields I do not need, some are blank. A typical line would be: Raw data: " ", "30142", "GA", "01001"," ", "MA","
1
2447
by: Jonathan Taylor | last post by:
I have a large XML file, that is too large to read in to XmlDocument. I need to append data to this XML file without creating a new file, since I don't want to have two copies of the large file on the server. I've not seen any example that works so far, even with google. Can anyone help ?
4
2367
by: Roshawn Dawson | last post by:
Hi, I'd like to know what's typically considered a large xml file? Are we talking about a file that's measured in kilobytes or megabytes and beyond? Where do we begin to consider an xml file to be a "large" file? Also, for small xml files and assuming that you want to perform an xsl transformation, is it justifiable to use the DOM or is it better to use the various xml readers and writers to do the job (although it may require more...
3
2974
by: clairePuj | last post by:
Hi everybody, Please can you tell me how can I read large data file (> 15 millions line) in C/C++ languge. Thanks for your help, Claire
4
2259
by: juan guerra | last post by:
Hello,... I am new in c programming and I have to do some data analysis of some files where I have a header a 5 columns of data. I want to reads the file, delete the wrong lines and wrong lines and save it in a new file. e.g. header2 data start at 00:00:00 09-09-07 10000 2000e-4 20000e-4 2000e-4 20000e-4 .............. wrong files: 10001 65000 65000 65000 65000 or 10001 2000e-4 3000e-4 2000e-4 100002 2000e-4
1
1772
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: I posted the following code two days ago when I face problem that my code could not upload large data or to be prices more than 4 MB. The code are : Dim arrayImage As Byte() = FileUpload1.FileBytes TextBox1.Text = FileUpload1.FileName Dim nStr As String =
1
1688
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: I have the following code to download the data from my web application: the code is: Dim rawan As New List(Of String) ' for File Name Dim rawan1 As New List(Of Byte()) ' for the data for each file Dim objconn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("Husam").ConnectionString)
1
3153
by: raj | last post by:
we have a 3 gig of xml data. we need to transform this data using our XSL file. when i use the regular transform methods of course i run out of memeory. the XSL file has quite bit of rules so i really cannot move them in to my code. is there way to transform the file streamingly? thanks.
5
1686
by: CSharper | last post by:
I have a data file which is 2.1GB (zipped), when the exe runs, it copies the content of the zip file to a destination folder. What is the best way to achive this? Current implementation is to zip the file at the source and at the destination unzip the file and if the file dates are different then copy the files over. Is there a better way to do this other than zipping and unzipping? Thanks.
0
8222
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8354
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6634
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5726
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2371
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1458
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1195
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.