147,315
questions
-3
votes
0
answers
14
views
create a data dictionary as a function in R using data.table
How can I write a function,
f(dfa,dfb, s1a,s2b,s1b)<-function(
...
)
so that if dfa$s1a == df2$s1b then dfa$s1a<-dfb$s2b
it means the function takes two data frames and compare s1a with s1b ...
0
votes
0
answers
19
views
How to get numeric values from Oracle DB table as is into pandas data frame
Trying to load numeric column values from an existing oracle DB table into pandas data frame but all the numeric values are taking decimal part while exporting the columns into csv file except the 1st ...
0
votes
2
answers
39
views
How to identify the rows of a df1 that have an element contained in a df2 in python?
I have two dataframes that I would like to compare, and I would need to know if the objects stored in df1 are also present in my df2.
However, objects of my df2 are longer because of many additional ...
3
votes
4
answers
60
views
Mutate the column name from the corresponding selected value among many columns
Let's consider markers with their coefficient of variation (cv) and three reference cv (rcv):
Initial data:
marker cv rcv1 rcv2 rcv3
<chr> <dbl> <dbl> <dbl> <dbl&...
0
votes
1
answer
31
views
Filter formula in excel displays part of the table
A table was created on one excel sheet. On the second sheet, I entered the data filter formula from the first sheet. If you add data to the first sheet table manually, the filter produces the correct ...
0
votes
0
answers
18
views
Write pandas DataFrame into a sheet of an `.ods` file without changing the rest? (python)
Suppose I have a pandas.DataFrame called df and an open spreadsheet file file.ods with a sheet mysheet. What is the standard way of writing df to mysheet in file without changing file any other way? ...
0
votes
0
answers
24
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
9
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
34
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
12
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
44
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
83
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
41
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
34
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
65
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, ...