Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
39 views

I'm trying to visualize the all launch records in a dataframe on folium map

# Add marker_cluster to current site_map site_map.add_child(marker_cluster) # for each row in spacex_df data frame # create a Marker object with its coordinate # and customize the Marker's icon ...
KORAKANTI SURYAPRAKASH's user avatar
0 votes
0 answers
767 views

I'm getting an import error with ydata-profiling-4.4.0: `BaseSettings` has been moved to the `pydantic-settings` package

I know that Pydantic V2 introduced new things which make it incompatible with V1, so I switched from pandas_profiling to ydata_profiling. Because of that, I had to switch versions of the dependencies, ...
Atharva Rao's user avatar
0 votes
1 answer
27 views

in python pandas data frame shift values from Category to Rating, Rating to Reviews, ............ ,Current Ver to Android Ver

This is my main data: I need to change this line of data: This is my output: In python pandas data frame shift values from Category to Rating, Rating to Reviews, etc. Current Ver to Android Ver. ...
Navaneeth O M's user avatar
0 votes
3 answers
75 views

How to change a string value with comma (343,543) to int in a dataframe with Python

I have a CVS file IMDb list. The number of votes is written like 345,545, and Python sees this like a string. I want to change this to a number value for using operations like <,+,% and I want to ...
Uğur Fatih Çokuçkun's user avatar
0 votes
1 answer
113 views

Is there a way to generate a completely new text column for a pandas dataframe?

I have a pandas dataframe that contains multiple features such as age, gender , many symptoms with the values 0 or 1 indicating if the patient has that particular symptom or not and the target being ...
Hedi Amor's user avatar
1 vote
1 answer
590 views

My test and train data has the same number of columns but OneHotEncoder creates different size of matrixes

I am trying to create a model with train and test datasets which are seperate. They have same number of columns. When I try to encode categorical features the created matrix by OneHotEncoder is comes ...
santiaqool's user avatar
0 votes
1 answer
52 views

How to allow user to reorder list when presented with one?

I want to create a list of unique values from a column of a DataFrame and then allow the user to sort the list arbitrarily based on their preference of the items in the list. For example: fruit_info = ...
datagolfer's user avatar
0 votes
1 answer
42 views

Matplotlib: Plotting all columns on the x-axis and values on the y-axis grouped by a third variable

I have data that looks like this: group var1 var2 var3 0 0.6 0.001 0.11 1 -0.36 -0.007 -0.066481 I want to create a dot graph where the 3 different variables form ...
sharkbirth's user avatar
0 votes
2 answers
71 views

Why can’t I use df.loc() within the drop() method?

I’m just getting started on pandas and I was trying to delete a sequence of rows. In my data frame, the index is the province names. Since df.loc[‘NL’:’QC’] returns a list of rows, I thought I would ...
Donna_Tartare's user avatar
2 votes
2 answers
69 views

Python / Pandas: Shift entities of a row to the right (end)

I have the following data frame (number of "Date" columns can vary): Customer Date1 Date2 Date3 Date4 0 A 10 40.0 NaN 60.0 1 B 20 50.0 NaN NaN 2 ...
dark water's user avatar
1 vote
2 answers
100 views

How to calculate time differences without a date and only with times?

import pandas as pd stoptimes_df = pd.DataFrame({ 'trip_id': ['1', '1', '1', '2', '2', '2'], 'arrival_time': ["12:10:00", "12:20:00", "12:30:00", "27:32:00&...
deputy-chief-hardy's user avatar
1 vote
1 answer
589 views

Fill NaN values in Polars using a custom-defined function for a specific column

I have this code in pandas: df[col] = ( df[col] .fillna(method="ffill", limit=1) .apply(lambda x: my_function(x)) ) I want to re-write this in ...
Honio's user avatar
  • 13
0 votes
1 answer
24 views

How to simplify "Percentage for each class"

I have the famous titanic data set fr1 = pd.DataFrame({ "class": ["1", "2", "2"], "survived": [0, 1, 1]}) I need to get the percentage of people who ...
Josue Medina's user avatar
0 votes
1 answer
33 views

How to simplify "Get mean ages for women of every class"

I have the famous titanic dataset, called fr1. The class column contains the following: 1, 2, 3 The gender column: male, female I want to obtain the mean ages for females for each class, I think It ...
Josue Medina's user avatar
1 vote
3 answers
135 views

Using linear optimisation, how do I minimize the Total Cost in a dataframe [closed]

I have a Pandas dataframe with 3 columns (Product, Weight, Total Cost) as follows (expanded to make it clearer): df = { 'Product': ['Product 1', 'Product 2', 'Product 3', 'Product 4', ...
t24opb's user avatar
  • 21

15 30 50 per page
1
2 3 4 5
181