csv

Python function about chemical formulas

Python function about chemical formulas Question: I have a CSV file that contains chemical matter names and some info.What I need to do is add new columns and write their formulas, molecular weights and count H,C,N,O,S atom numbers in each formula.I am stuck with the counting atom numbers part.I have the function related it but …

Total answers: 1

How to write dataframe to csv for max date rows only (filter for max date rows)?

How to write dataframe to csv for max date rows only (filter for max date rows)? Question: How do I get the df.to_csv to write only rows with the max asOfDate? So that each symbol below will only one row? import pandas as pd from yahooquery import Ticker symbols = [‘AAPL’,’GOOG’,’MSFT’] #There are 75,000 symbols …

Total answers: 1

Write "null" if column doesn't exist with KeyError: "['Column'] not in index" in df.to_csv?

Write "null" if column doesn't exist with KeyError: "['Column'] not in index" in df.to_csv? Question: I am getting KeyError: "[‘CashFinancial’] not in index" on the df.to_csv line because ‘GOOG’ doesn’t have the CashFinancial column. How can I have it write in null for the CashFinancial value for ‘GOOG’? import pandas as pd from yahooquery import …

Total answers: 2

Lookup of Data from a CSV file in Python

Lookup of Data from a CSV file in Python Question: How do I achieve this in Python. I know there is a vlookup function in excel but if there is a way in Python, I prefer to do it in Python. Basically my goal is to get data from CSV2 column Quantity and write the …

Total answers: 4

transform Csv file to list of lists with python?

transform Csv file to list of lists with python? Question: I want to be able to turn csv file into a list of lists . my csv file is like that : [‘juridiction’, ‘audience’, ‘novembre’],[‘récapitulatif’, ‘information’, ‘important’, ‘octobre’],[‘terrain’, ‘entent’, ‘démocrate’],[‘porte-parole’, ‘tribunal’, ‘monastir’, ‘farid ben’, ‘déclaration’, ‘vendredi’, ‘octobre’, ‘télévision’, ‘national’, ‘mère’, ‘fillette’, ‘an’, ‘clandestinement’, ‘italie’, ‘juge’, …

Total answers: 2

Splitting a large CSV file and converting into multiple Parquet files – Safe?

Splitting a large CSV file and converting into multiple Parquet files – Safe? Question: I learnt, the parquet file format stores a bunch of metadata and uses various compressions to store data in an efficient way, when it comes to size and query-speed. And it possibly generates multiple files out of, let’s say: one input, …

Total answers: 2

Pandas: faster string operations in dataframes

Pandas: faster string operations in dataframes Question: I am working on a python script that read data from a database and save this data into a .csv file. In order to save it correctly I need to escape different characters such as rn or n. Here is how I am currently doing it: Firstly, I …

Total answers: 1