All Questions
460 questions
1
vote
2
answers
58
views
python only appends 1 row of CSV to two-dimensional array
I'm writing code where I store employees information as a CSV file and then append it to a two-dimensional array inside python. However I only get the first row appended. As well as when I enter a ...
2
votes
2
answers
69
views
Save 2 variables from an array to .csv
I have 2 coordinate variables lon and lat
(array([-50.940605, -37.424145, -41.501717, -37.98916 , -60.632664,
-38.158283, -58.0372 , -39.06596 , -60.815792, -49.303684,
-38.46074 , -50....
1
vote
1
answer
78
views
How to create multiple combined csv files out of a multi-dimensional numpy arrays
I have 8 numpy arrays of the dimensionalty (number_of_buildings, number_of_weeks) which in my example is (2, 20). They look like that:
import numpy as np
...
1
vote
2
answers
36
views
How to make file changes start from the next cell
Look, I have a file with headers on the first row: ["Date of creation", "ID", "Note"]
And I have a function that changes a specific line,
but the changes occur from the ...
0
votes
1
answer
39
views
Getting IDs for nested arrays extracted from JSON docs
I have a Python code that takes JSON documents from a local MongoDB, extracts nested arrays and replaces them with ids. It then exports the three resulting sets of data to CSV files. It works well, ...
0
votes
2
answers
1k
views
How to transform each array of a list of array into a csv file
I have a list of array saved as Array1 that consists of 3880 array, each array has 257 elements. I want to save each one of the 3880 arrays in the same csv file but each array I want to save in one ...
0
votes
0
answers
29
views
I need to find peaks in the data of the y-Gforce difference
I need a python script that finds the peaks of each period in a csv file wih the following format:
time
gFx
gFy
gFz
0
0,0039
0,0005
0,0008
...
...
...
...
8
0,0052
0,0015
-0,0002
the values ...
-1
votes
2
answers
527
views
Convert rows into array
I want to convert all the rows into array.
E.g. I have multiple values which is stored in CSV.
Suppose in A1 position value is Message
In B1 position value is Field=1234
In C1 position value is Field=...
-2
votes
1
answer
49
views
How can I delete a row from array and then add a new row to dictionary?
I have an array called teams[] which I filled with data from a csv file (the csv has a team and a score):
teams = []
with open("2018m.csv", "r") as file:
reader = csv....
0
votes
1
answer
1k
views
How to convert numpy array saved as string in pandas csv file back to a numpy array?
I saved with pandas a numpy array to a csv file:
df['Feature5'][i] = str(ri_RGBA.tolist())
df.to_csv(r'H:\test.csv')
The csv file has the following structure:
Feature1,Feature2,Feature3,Feature4,...
2
votes
1
answer
32
views
Csv file 2d array and txt file 2d array comparison
def read_text_file(filename):
with open(filename, 'r') as file:
array = [line.split() for line in file]
return array
array = read_text_file("file.txt")
print(array[0][1])
...
-1
votes
2
answers
234
views
Convert Dictionary to Dataframe Pandas [duplicate]
i have multiple dict as array which i want to convert to dataframe
df= [{'Federal-gov': 0, 'Local-gov': 1, 'Never-worked': 2},
{'Divorced': 0, 'Married-AF-spouse': 1, 'Married-civ-spouse': 2, 'Married-...
0
votes
1
answer
188
views
Continue running code when KeyError: "['Column'] not in index" occurs for null values?
I get KeyError: "['marketCap'] not in index" when there is no data in the "marketCap" column for a particular symbol. How do I put "Null" when there's no data so the ...
1
vote
1
answer
281
views
How to write one array value at a time (dataframe to csv)?
This is working great, but I have thousands of rows to write to csv. It takes hours to finish and sometimes my connection will drop and prevent the query from finishing.
import pandas as pd
from ...
0
votes
2
answers
329
views
Get Values from CSV to pass as Arguments in Array/List (Python)
I would like to find values from one CSV in another and modify/remove the rows accordingly.
Removing already works quite well, but I would like to automate this process as much as possible.
So my ...