147,309
questions
0
votes
0
answers
8
views
Modifying range in Traffic light Iconset in Openpyxl
I have a sample data in excel like as below
cust_id,avg_purchase
1,0.2
2,0.5
3,100
4,9
5,1
6,31
7,9.5
8, "No purchase"
9, "No purchase"
I would like to do the below using Openpyxl
...
0
votes
0
answers
5
views
Pandas convert_dtypes(infer_objects=Fals, convert_string=True) converting numeric data into string only for 1st occurrence of numeric column
I'm trying to load data from oracle DB table into pandas dataframe in a string format where my table has many NUMBER fields having data without decimal places.
ex. tableA (col1 varchar2(30), col2 ...
0
votes
1
answer
33
views
Create new variable based on partial string matching in column R
I have a large df with Columns: "Gene, variable, value" to which I would like to add a new variable "light_exposure". To assign the value to this new column I would like to see if ...
0
votes
0
answers
11
views
Banding function showing 'none' values instead of defined values in Pandas [duplicate]
I'm trying to band years into decades to make visualisation clearer and my function appears to work initially:
def banding(year):
if year <= 1989:
print ('1980s')
...
1
vote
1
answer
39
views
how do you select the maximum value accross each row in pandas
Hi have this data frame:
Server 1-Jun 6-Jun 1-jul Jul-10
ServerA 8 9 5 90
ServerB 100 10 9 90
I need to create another column called maximumval and pick ...
1
vote
1
answer
82
views
Efficient manner to compare and match structures between two data frames in R? [closed]
I'm working on a function for comparing the structures of two data frames in R, in order to build a validation filter for uploading data into a table. I realize that when you have a data frame in R ...
0
votes
0
answers
36
views
how create new column or update column inside a dataframe?
Good morning eveyone
I have a question today, that i don't know exactly how to do.
Having a dataframe, i need create columns dynamically, and those column will contein a set of validations that i have ...
0
votes
0
answers
33
views
Error in as.vector(x, mode) : cannot coerce type 'closure' to vector of type 'any' in R [closed]
I am trying to create a table one in R to compare two treatment groups. Here is my code:
`my_vars <- c("Sex", "Age", "Country_of_inclusion", "GBSDS_w4", &...
1
vote
2
answers
63
views
How to expand a single-index DataFrame to a multiindex DataFrame in an efficient way? (python, pandas)
import pandas as pd
concordance_region = pd.DataFrame(
{
"country 1": pd.Series([1, 0], index=["region a", "region b"]),
"country 2": pd.Series([0, ...
7
votes
5
answers
305
views
Calculate transition probabilities
I have this data:
simulated_states = c("A", "E", "B", "B", "A", "C", "D", "A", "B", "D", "A&...
-3
votes
1
answer
48
views
PANDAS performance: which is better
OK ewes experts which of the following python pandas is more :performant
1) using a python list comprehension
import pandas as pd
df = pd.read_csv('datasets/large_columnset.csv', index_col=0)
df....
0
votes
1
answer
43
views
How convert a list into multiple columns and a dataframe?
i have a challenge today, is:
Having a list of s3 paths, inside a list, split this and get a dataframe with one column with the path and a new column with just the name of the folder.
my list have the ...
0
votes
0
answers
27
views
add pandas dataframe to exist postgresql database
I have read and tried a lot of posts on stackoverflow about adding a pandas dataframe to an existing postgresql database.
Here is my code
conn=psycopg2.connect(dbname='mypostgres', user='...', ...
4
votes
1
answer
73
views
Consolidate Excel File with Images and Write the Output with the Image into Excel in R
I am trying to consolidate two excel file with the same column names and write the output into an another excel file while keeping the images in place.
But whenever I consolidate the output, the ...
0
votes
2
answers
38
views
Create Pivot table and add additional columns from another dataframe
Given two identically formatted dataframes:
df1
Counterparty Product Deal Date Value
foo bar Buy 01/01/24 10.00
foo bar Buy 01/01/24 10.00
foo ...