dataframe Questions

4

From reading the pandas documentation, and a good question and answer (What does axis in pandas mean?), I had expected axis=0 to always mean with respect to columns. This works for me when I work w...
Sleeper asked 31/3, 2018 at 11:23

2

Solved

I have a data frame for example df = pd.DataFrame([(np.nan, .32), (.01, np.nan), (np.nan, np.nan), (.21, .18)], columns=['A', 'B']) A B 0 NaN 0.32 1 0.01 NaN 2 NaN NaN 3 0.21 0.18 And I want to ...
Studied asked 15/1, 2021 at 5:38

2

Solved

I am trying to iterate over each row of a Polars rust dataframe. In this endeavour, I have found df.get but the documentation says that this is slow. Then I have tried df.column("col").ge...
Protector asked 30/5, 2022 at 21:59

5

I'd like to apply a user-define function which takes a few inputs (corresponding some columns in a polars DataFrame) to some columns of a polars DataFrame in Rust. The pattern that I'm using is as ...
Cid asked 25/5, 2022 at 6:27

5

Solved

I have a column in a dataset looking like this: cluster_id 1 1 1 1 NA 1 NA NA 2 NA 2 NA 3 NA NA 3 cluster_id <- c("1","1","1","1","NA","1...
Hottempered asked 27/9 at 10:0

3

Solved

I have a piece of code that was working fine until last week, but now it's failing with the following error: AttributeError: module 'fiona' has no attribute 'path' I’ve ensured that all the necessa...
Confiture asked 4/9 at 14:6

4

Given an example dataframe where we have column 'b' containing lists, and each list has the same length (so it also could be converted to arrays) df_test = pl.DataFrame({'a': [1., 2., 3.], 'b': [[2...
Boor asked 25/3 at 10:19

4

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> 1 ...
Selenite asked 20/9 at 8:6

5

Solved

I have this data: simulated_states = c("A", "E", "B", "B", "A", "C", "D", "A", "B", "D", "A&...
Nedry asked 19/9 at 2:8

2

Solved

I have a dataframe like: data = { "a": [[1], [2], [3, 4], [5, 6, 7]], "b": [[], [8], [9, 10], [11, 12]], } df = pl.DataFrame(data) """ ┌───────────┬───────────┐...
Ronn asked 15/9 at 17:45

4

Solved

I want to filter all duplicated rows from a polars dataframe. What I've tried: df = pl.DataFrame([['1', '1', '1', '1'], ['7', '7', '2', '7'], ['3', '9', '3', '9']]) df shape: (4, 3) ┌──────────┬──...
Velate asked 4/5, 2022 at 11:53

1

I am getting Future Warning with Pandas 2.2.2 when I try to concatenate DFs with Floating Values and Nones. But the same won't happen if I use INT instead of FLOAT import pandas as pd # Block with...
Viscera asked 6/9 at 12:54

4

Solved

I am working with 2 datasets. One describes some time windows by their start and stop times. The second one contains a big list of events with their corresponding timestamps. I want to combine this...
Avilla asked 25/8 at 20:14

4

Solved

I have a Dataframe I wish to write a few rows of into a file and logger in Python 2.7. print(dataframe.iloc[0:4]) outputs a nice grid of the column headers and top 4 rows in the dataframe. However ...
Snobbish asked 28/2, 2017 at 17:47

4

I have a dataframe with 'execution_date' columns containing dates. So there are also >150 columns which are named as dates '01.03.2023', '02.03.2023' etc. The dataframe itself is empty. The data...
Blinding asked 3/9 at 14:17

3

Solved

I have a dataframe that has a field called fields which is a list of dicts (all rows have the same format). Here is how the dataframe is structured: formId fields 123 [{'number': 1, 'label': 'Last...
Zygodactyl asked 28/8 at 22:4

4

Solved

If you come from the future, hopefully this PR has already been merged. If you don't come from the future, hopefully this answer solves your problem. I want to solve my problem only with polars (wh...
Confetti asked 28/8 at 7:29

3

Solved

My filter_list has a large number of elements. The filtering below works but how would one make the dplyr::filter more concise? I couldn't make all_of work. filter_list <- list( hair_color = c(...
Laudanum asked 27/8 at 21:28

2

Solved

I'm pretty new to Python and StackOverflow so bear with me if I make mistakes in this post. I have a Pandas dataframe with 1 minute open, high, low, and close data, with time as the index, for a ...
Culvert asked 14/6, 2020 at 14:11

2

Solved

tldextract is used to extract domain names from the URLs. Here, 'url' is one of the column name in the data frame 'df'. It is possible to pass one value of 'url' as a parameter. However, I am not a...
Bloke asked 15/7, 2018 at 11:11

2

Solved

I have a large file that I'm trying to reduce using dataframe.drop Here's my code: probe_df = pd.read_csv(csv_file,header = 9233, nrows = 4608) # Get rid of stuff c_to_drop = 'Unnamed: ' + str(coun...
Dominik asked 6/6, 2023 at 2:21

4

Solved

At first it was working fine, then I tried to tweak a few parameters in creating the model, after that, print(model.history.history) gives me an empty dictionary. here is my entire code if it h...
Colotomy asked 10/6, 2020 at 9:9

3

Solved

I have two pandas DataFrames: import pandas as pd data1 = { 'score': [1, 2], 'seconds': [1140, 2100], } data2 = { 'prize': [5.5, 14.5, 14.6, 21, 23, 24, 26, 38, 39, 40, 50], 'seconds': [840, ...
Esposito asked 27/2 at 12:15

2

Solved

I would like to perform an action on a single column. Unfortunately, after I transform that column, it is now no longer a part of the dataframe it came from but a Column object. As such, it cannot ...
Quidnunc asked 19/2, 2016 at 0:32

3

Solved

There is a great solution in R. My df.column looks like: Windows Windows Mac Mac Mac Linux Windows ... I want to replace low frequency categories with 'Other' in this df.column vector. For exam...
Unfriendly asked 21/11, 2017 at 16:43

© 2022 - 2024 — McMap. All rights reserved.