bst365体育投注网址大全

Questions tagged [pandas]

Pandas is a Python library for data manipulation and analysis, e.g. dataframes, multidimensional time series and cross-sectional datasets commonly found in statistics, experimental science results, econometrics, or finance. Pandas is one of the main data science libraries in Python.

Filter by
Sorted by
Tagged with
0
votes
0answers
2 views

Randomly drop elements from pandas series, based on a condition

I have a pandas series with ~150 million float elements. I am trying to randomly drop a 50% of all elements whose value lie between a specific range (say, between -0.1 and 0.1). Normally I would (1) ...
0
votes
1answer
12 views

How to make a function for counting no of stops

I wanted to split the text and and count the no of stop btw the arrival and departure destination . route column is given below. Need to make a new column name as 'No of stop' where stops value is ...
1
vote
1answer
15 views

Errno 36: File name too long error parsing python XML

I have an XML file I am trying to parse and access one root of: DonorAdvisedFundInd which I shouldn't have a problem with but when I'm trying to parse the XML file I get an error message saying: [...
0
votes
0answers
12 views

Uploading Pandas df to SQL Server

I run a python script every day and the data need to be dumped to sql table. My dataframe look like: df2 = pd.DataFrame(np.array([[1, 2, 3], [2020, 2020, 2020], [7, 8, 9], [7, 8, 9]]), ...
0
votes
1answer
19 views

pandas groupby includes dates that is not present

I am working with the e-commerce dataset and I have the following code snippet data["grossprice"] = data["UnitPrice"]*data["Quantity"] total_date = data.groupby(["...
2
votes
1answer
14 views

Python Pandas : Change value based on category's highest frequency

I discovered a categorization error in a dataset I was exploring. The dataframe looks like this: df1 = pd.DataFrame({ 'product': ['ABRICOTS', 'ABRICOTS', 'ABRICOTS', 'ABRICOTS', '...
1
vote
1answer
17 views

Is it possible to plot a barchart with upper and lower limits of the bins with Pandas,seaborn or Matplotlib

I will like to know how I can go about plotting a barchart with upper and lower limits of the bins represented by the values in the age_classes column of the dataframe shown below with pandas, seaborn ...
0
votes
0answers
4 views

SSL module issue while installing pandas on RHEL6

Did anyone got the issues while installing with pandas.. I also tried configuring with ./configure --with-openssl="/usr/bin/openssl" # /opt/bin/python3 -m pip install numpy scipy ...
3
votes
3answers
35 views

How to check whether each value of one column maps to exactly one value in another column?

I have a dataframe like this import pandas as pd df = pd.DataFrame({'A':list('bbcddee'), 'B': list('klmnnoi')}) A B 0 b k 1 b l 2 c m 3 d n 4 d n 5 e o 6 e i and I would like to ...
3
votes
2answers
23 views

Pandas: merge columns with the similar names

Politics Politics Politics Arts/Culture Arts/Culture Arts/Culture nan nan c nan nan c nan b nan a nan nan ...
1
vote
3answers
41 views

Pandas: create column based on first off occurrences in column B after signal in column A

I have A column with signal on == 1 and B column with signal off == 1 ,the rest values are zero. data = {'A': [1, 0, 0, 0, 0, 1, 0], 'B': [1, 0, 1, 1, 0, 0, 1]} df = pd.DataFrame.from_dict(...
2
votes
4answers
38 views

How can I improve the speed of pandas rows operations?

I have a large .csv file that has 11'000'000 rows and 3 columns: id ,magh , mixid2. What I have to do is to select the rows with the same id and then check if these rows have the same mixid2; if True ...
2
votes
1answer
24 views

In Python how to use row value to refer to columns [duplicate]

I have a dataframe like this import numpy as np import pandas as pd np.random.seed(1) df=pd.DataFrame(np.c_[np.round(np.random.rand(5,3),1), np.random.choice(list('abc'),5)],columns=list('abcd')) ...
0
votes
1answer
28 views

Is there a way of summing specific columns if they exist in a list?

I'm trying to lookup a column in df2 and only sum the columns in df1 that exist in the df2 column df1 = London, New York, Paris, LA, Chicago 1000, 2000, 5000, 10000, 3000 df2 = US Cities New York ...
-1
votes
1answer
18 views

How to join two data-frames based on one column?

I have two data-frames. Suppose the first data frame looks like, Column1 | Column2 M1 | C1 | C2 | C3 M2 | C2 | C4 M3 | C3 The second data-frame ...

15 30 50 per page
1
2 3 4 5
10630