Click here to Skip to main content
15,880,725 members
Everything / DataFrame

DataFrame

DataFrame

Great Reads

by Bahrudin Hrnjica
In this article, we are going to explore the main features in the new C# Juypter Notebook.
by Bahrudin Hrnjica
Notebook completely implemented on .NET platform using C# Jupyter Notebook and Daany

Latest Articles

by Bahrudin Hrnjica
Notebook completely implemented on .NET platform using C# Jupyter Notebook and Daany
by Bahrudin Hrnjica
In this article, we are going to explore the main features in the new C# Juypter Notebook.

All Articles

Sort by Score

DataFrame 

16 Nov 2019 by Bahrudin Hrnjica
In this article, we are going to explore the main features in the new C# Juypter Notebook.
8 Nov 2021 by Maciej Los
I'd suggest to read this: pandas.DataFrame.pivot — pandas 1.3.4 documentation[^]
20 Apr 2022 by Richard MacCutchan
You first need to structure the data into a form that pandas can process. See pandas.DataFrame — pandas 1.4.2 documentation[^].
29 Aug 2020 by Eddie Winch
Hi there, I am using the following line of Code to get a DataFrame Output using Pandas :- import pandas as pd import requests from bs4 import BeautifulSoup import numpy as np import datetime as dt class work: def __init__(self,link): ...
8 Apr 2022 by Maciej Los
Not sure what's wrong with your code. I tried to reproduce your issue, but i can't. Below code is working fine: import pandas as pd ids1 = [1, 2, 3, 4] ids2 = ['A', 'B', 'C', 'D'] esc1 = [1, 0, 0, 0] esc2 = [0, 1, 0, 2] esc3 = [0, 0, 3, 0] ...
7 Jan 2023 by Dave Kreskowiak
Seriously? How do you not see this? The error message told you exactly what is wrong. Your date format specifier is '%d-%m-%y'. It's looking for a string with the values IN ORDER: day, month, year. The date string you're passing in is day, YEAR,...
9 Jan 2023 by Richard MacCutchan
The KeyError is because you are using the boolean value True as an index into the date_col_search list in line 15. So change your code from line 13 on to the following: for i in range(date_col_search): if date_col_search[i] is True:...
23 Apr 2023 by Richard MacCutchan
The to_datetime function converts a date and time string from text to a DateTime object, not the other way round. So your format string must match the format of the date strings you are converting. See pandas.to_datetime — pandas 2.0.0...
26 Apr 2023 by Richard MacCutchan
When I use the value 45678 I get the following result: Python test result: 2095-01-23 00:00:00 [edit] I think I have found the problem. The following line tries to check if every column of the frame contains only numeric values: if...
23 Aug 2023 by Andre Oosthuizen
Your issue might be related to the indexing of your 'gap_series DataFrame'. The '.tail(200)' method you are using is used to select the last 200 rows of your 'DataFrame', which might not be available for all coins at all times. This could result...
13 Apr 2020 by Anan Srivastava
Is there a better way to shuffle the rows of a data frame and read them in chunks than what I currently have? What I have tried: This is my attempt: df = pd.read_csv("ExtractedData.csv") df_sampled = df.sample(frac=1)...
21 Aug 2020 by Eddie Winch
Hi there I have the Following Code, which I run in Jupyter Notebook :- import pandas as pd import requests from bs4 import BeautifulSoup #res =...
20 Aug 2020 by OriginalGriff
Parse each line, and convert the date information to a datetime — Basic date and time types — Python 3.8.5 documentation[^] Those should sort "properly" where strings sort by finding the first different character pair and basing the whole...
23 Aug 2020 by Eddie Winch
Hi there, I have the following Python Code, which is run in Jupyter Notebook :- import pandas as pd import requests from bs4 import BeautifulSoup import numpy as np import datetime as dt class work: def __init__(self,link): ...
16 Mar 2021 by Member 12645291
I want to create 2 data frames out of the below list:- results = [ {'type': 'check_datatype', 'kwargs': {'table': 'cars', 'columns': ['car_id','index'], 'd_type': 'str'}, 'datasource_path': '/cars_dataset_ok/', ...
5 Apr 2021 by Eddie Winch
Hi there, I am using the following Line Of Code, in Pandas :- diff = df6.loc[~df6['Venue'].isin(df1['Venue'])] diff And I am not getting, the DataFrame Output result I want. I wan't to have the DataFrame Rows Showing, where any Rows in the...
6 May 2021 by Vivek R G
I have made a pivot table for 4 columns. I have to plot the chart of that table.But at some places there is value NaN, which is making the plot to have gaps in between I want all the gaps to appear a line between the previous and forward point....
14 Jun 2021 by Richard MacCutchan
You already posted this question at Is there any function which can search for duplicate node based on specific attribute value and copy sub-elements/child elements to it?[^]. Please do not repost; if you have additional information then edit...
9 Jul 2021 by pythonHumanBot
I'm trying to convert a Pandas DataFrame column from UNIX to Datetime, but I either get a mismatch error or the new dates are all 1970-01-01... I'm stuck for hours not knowing how to fix this... What I have tried: When I look at how my UNIX...
1 Sep 2021 by Karan Hada
pd = pd.DataFrame({'Priority order':[1,2,3,4,5], 'bike_id':[11,12,13,14,15], 'lat':[13.027514,13.037857,12.937877,13.091736,12.959291], 'long':[77.723228,77.705032,77.751419,77.564781,77.727295]}) pd1 =...
8 Nov 2021 by MaJaxx
Complete newby here. I'm trying to parse a quite long simulation output with Python into a frame and write it into an excel sheet. I only want to parse certain entries, not the whole thing. (See my code below) The output I am trying to parse: ...
19 Feb 2022 by Manish A
Main Table: Date_And_Time Date Time Tags Value A B C 2022-02-08 06:01 2022-02-08 06:01 A01.B04.C_01 1 A01 B04 C_01 2022-02-08 06:01 2022-02-08 06:01 A01.B04.C_02 2 A01 B04 C_02 2022-02-08...
6 Mar 2022 by Richard MacCutchan
Look at the documentation: pickle — Python object serialization — Python 3.10.2 documentation[^]. The load method requires a file object as the first parameter.
10 Mar 2022 by Member 15561848
64 66 81 02 73 -column 1 64 96 34 81 22 - column 2 I have two columns with 5 elements. I want to transpose it. Expected Output : 64 66 81 02 73 - column 1 61 96 34 81 22 - column 2 What I have tried: I have tried transposing but...
10 Mar 2022 by Maciej Los
Seems you want to use pandas.DataFrame.melt[^], which unpivot a DataFrame from wide to long format, optionally leaving identifiers set. Follow the link for examples.
29 Mar 2022 by Member 15564814
it's a little bit complicated , i have this dataframe : ID TimeandDate Date Time 10 2020-08-07 07:40:09 2022-08-07 07:40:09 10 2020-08-07 08:50:00 2022-08-07 08:50:00 10 2020-08-07 12:40:09 2022-08-07 ...
8 Apr 2022 by Sik Saw
I have a dataframe df ID ID2 escto1 escto2 escto3 1 A 1 0 0 2 B 0 1 0 3 C 0 0 3 4 D 0 2 0 so either using indexing or using wildcard like column name 'escto*' if df.iloc[:, 2:]>0 then df.helper=1 or df.loc[(df.iloc[:, 3:]>0,'Transfer')]=1...
20 Apr 2022 by Member 15609211
Hello, I have a .txt that goes like this: USA Arizona - New Mexico Interstate 40 Interstate 10 South Dakota - Minneapolis Interstate 90 South Carolina - Washington Arizona - California ...
2 Jun 2022 by A v Nov2021
df = pd.DataFrame({'A': [1,4,4,3,7], 'B': [1,2,2,6,4], 'C ': range(10, 5, -1)}) A B C 1 1 10 4 2 9 4 2 8 3 6 7 7 4 6 This is my data frame with 5 rows and 3 columns. I have to find a way to drop rows by...
2 Jun 2022 by Richard MacCutchan
I am not 100% certain that this solves your problem, but it does what I think it is supposed to do: print(df) indexA, indexB = df.idxmax('index').values[:2] print(F"\n{indexA = }, {indexB = }") if indexA != indexB: df2 = df.drop(indexA)...
16 Oct 2022 by Member 15753358
I have 2 dictionaries and a list which have information as: dic_merged={'A': [['K', 'J'], 2.0], 'B': [nan, nan], 'C': [['Y'], 1.0], 'D': [['B', 'C'], 2.0], 'J': [nan, nan], 'K': [nan, nan], 'G': [['A', 'H'], 2.0], 'Y': [['Z'], 1.0], 'H':...
27 Nov 2022 by Member 15356357
I have this code working like this. i want this to ask for user input and put it inside pandas dataframe how many times do you want to input: 2 Input Name: First Input Age: 12 Input Name: Second Input Age: 32 ['First', 12, 'Second', 32] #this...
27 Nov 2022 by Richard MacCutchan
See Intro to data structures — pandas 1.5.2 documentation[^] for different ways to construct a DataFrame.
8 Jan 2023 by Apoorva 2022
I'm programmatically trying to detect the column in a dataframe that contains dates & I'm converting the date values to the same format. My logic is to find the column name that contains the word 'Date' either as a whole word or as a sub-word...
11 Mar 2023 by Apoorva 2022
I have a function that divides the values of a numeric column into the specified number of bins/categories, based on the ranges they fall into. These categories are numbered from 0 to the limit specified. And the column values are replaced with...
11 Mar 2023 by Dave Kreskowiak
I don't do Python, but the error seems to be telling you that you're trying to iterate (for...) over something that is not a collection, but is a single object.
23 Apr 2023 by Apoorva 2022
I wrote a function that converts all the dates of the specified date column to the specified format. Any missing or invalid date is replaced with a value specified by the user. The issue is, all the dates are being converted to the same default...
23 Apr 2023 by OriginalGriff
Because datetime objects don't have a format: they are stored as a number of ticks since a specified point in time and only display as any format when they are converted to a string for presentation to the user. Since you fill your column with...
30 Apr 2023 by OriginalGriff
Because neither of them are known, standard date formats. If you want to process those, you will have to detect the failure, and write your own code to do the conversion.
30 Apr 2023 by Richard MacCutchan
I gave you the answer in your previous post of this question at Transformation of "serial date" to the specified date format[^]. And as you can clearly see, items 12 and 14 are not valid dates so will always convert to NaT Once you have done the...
16 May 2023 by Apoorva 2022
I have a dataset consisting of 'N' number of features/variables. One of these columns has missing values which I would like to interpolate. The interpolate() method of Pandas helps in doing so. The input for this method is the name of the column...
16 May 2023 by Apoorva666
I want to experiment with different interpolation techniques. Some determining factors for choosing the appropriate interpolation techniques are: 1. Density of data (Checking if the data is dense or sparse) 2. Dimensionality of data (High...
1 Mar 2020 by Bahrudin Hrnjica
Notebook completely implemented on .NET platform using C# Jupyter Notebook and Daany
25 Sep 2022 by Member 15776485
Hey all I am new to python.i need your help to create a data frame. I need 5 columns(category,service,profile,os,price) in my data frame. The data is in nested form under every category(Com,DB) we have different services(ABC,XYZ) under every...
26 Apr 2023 by Apoorva 2022
I wrote a function that converts all the dates of the specified date column to the specified format. Any missing or invalid date is replaced with a value specified by the user. The code also takes "serial dates" like "5679" into consideration....
23 Aug 2023 by Skeleton0408
I was coding a script that calculates percentage differnce of binance's close data and upbit's close data. import time import pandas as pd import pyupbit import ccxt import requests time.sleep(3) binanceX = ccxt.binance(config={ ...
21 Aug 2021 by Chandan Nagaraj 2021
I have data in dataframe in this following format: Row_1 AB123, 01-mar-2011, 30-mar-2011, data1, data2 Row_2 CD123, 01-mar-2011, 30-mar-2011, data1, data2 Row_3 CD123, 01-apr-2011, 30-apr-2011, data1, data2 Row_4 EF123,...
23 Oct 2021 by Kevin Paul 2021
Hi I am working on an Amazon dataset which does not follow the traditional row and column format. Kindly advice on the best way to convert this into a easily manipulatable dataset in R. Thank you Dataset: ...
6 Mar 2022 by Ayesha Tassaduq
i am trying to send a data frame through socket. But I got some errors i try to remove them but can't. can anoyone help me What I have tried: i have tried this code import socket import pandas as pd import pickle df =...
10 Aug 2022 by Gaeth Omari
df_4=pd.DataFrame() for i in range(100): if df_33[i]!=df_new[i]: print("not matching") else: dff=pd.concat([df_33,df_new]) print(dff) keyError:0 What I have tried: i was getting this error keyError:0
14 Oct 2022 by Fury_5698
I have many csv files with dataframes looking like these. Dummy Data: df1
7 Jan 2023 by Apoorva 2022
I wrote a program where a dataframe is traversed & when any column with the name 'Date' is encountered, all the rows under that column are supposed to be converted to a 'datetime' object using 'pd.to_datetime' in the format mentioned. But this...
30 Apr 2023 by Apoorva 2022
I have a code that converts all the dates in the specified date column to the specified date format. In case the date is invalid or empty, it gets replaced by the replacement value specified. My code works as expected for all values except the...